-
ok a while ago mosterdflash ask for my help on this subject but i couldn t help him because i din t have much time to make the fla so i felt a little bad :-<
i hope this will help him and i believe many others
do whatever you want with the fla as long as you give some credits
ciao
:D
http://digilander.iol.it/magneto1/rooms.swf
http://digilander.iol.it/magneto1/rooms.fla
use arrow keys to move the hero
[Edited by magnetos on 02-03-2002 at 07:29 PM]
-
-
Hi Magnet OS :D
After a loooooooong time of being busy, today I logged in FlashKit... and found your .fla for walking into rooms.
I love that... and would like to thank you for the .fla...
I tried once but I failed to do so... now, with the help of your .fla I may able to do something.... :D
Thanx again...
-
Okey i love that thing
But i got question i hope you'll help me
CAN YOU MAKE A SMALL TUTORIAL FOR ME?
AND TELL STEP BY STEP HOW YOU DID THAT ALL?
I know it might take a long time, but please i really want to know how..... if you will e-mail me [email protected] and than send me tutorial when you will have time, but first send me e-mail so i will know that you will do it for me....
Thx so much! =)
-
you welcome mmkhan i am glad i caN be of help
i also recieved your message ill take a look at that link later you know i am very curiuos :D
to KOTABoggy
the fla is pretty self explanatory but i ll try to explain
how it works
the red lines you see on the rooms are just lines which i converted in to movie clips
now i use flash5 hitTest function to detect when the hero hits that line
on room1 (frame1)
on the line mc to the right i put this code
onClipEvent (enterFrame) {
if (hitTest(_root.hero)) {//if this line hits the hero
_root.hero._x = 40;//place hero opposite side
_root.gotoAndStop(2);
}
}
that means that if the hero hits that line goto to and stop to room2 (frame 2)
notice _root.hero._x = 40;
this line makes sure that the hero wont step right over the left line on room 2
yes everytime you enter a room the position of the door and the hero must be exactly the opposite of the position they had in the room before
on room2 (frame2)
i put almost the same code on the left line and the upper line
the differnce is that if the hero hits the left line he has to go back to room1
else if he hits the upper line he goes to room3(frame3)
so on the left line mc on room 2 i put
onClipEvent (enterFrame) {
if (hitTest(_root.hero)) {
_root.hero._x = 510;//place hero opposite side
_root.gotoAndStop(1);//go back to room 1
}
}
and on the upper line mc i put this
onClipEvent (enterFrame) {
if (hitTest(_root.hero)) {
_root.hero._y = 340;//place hero opposite side
_root.gotoAndStop(3);//go to frame 3
}
}
i use the same tecnich for all the rooms
you just have to make sure that the entrance is always on the opposite side of the exit and viveversa
hope you got all this if not keep asking ........
:D ciao :D
-
i forgot to mention this code which is on the hero mc
if (this._x>530) {// right edge
this._x = 530;
}
if (this._x<40) {// left edge
this._x = 40;
}
if (this._y<30) {// up edge
this._y = 30;
}
if (this._y>360) {// down edge
this._y = 360;
}
what this code does is to constrain the hero to the movie edges on the main stage
in other words its a wall the hero can not go trough
so unless the hero hits the lines he will be confined to the bounding wall
ciaooo again :D
-
Thx a lot!=P
Now i'll try to make my own one =)
He-he Thx again!
-
This is a excellent work of you.
Before i had another kind of this.
Put i belive i will change to this. :)
Does this work if i use scenes instaed of
frames?
-
nicke85 ummm i think i talked to you recently did i :D
sure you can use scenes
instead of using frame1 2 3 4 etcc you can use scene 1 2 3 4 5 etc
although i dont see why the way i did it i think is much simpler you can check the code and your layout much easier just click on the next frame
then again everybody has his own personal methods.
i am thinking about puting some scenarios and stuff on this fla
but i gotta figure out a good hitTest function first
perhaps later
have fun guys
if you have prob or you actually make a good rpg (i mean good not stiff figures walking on a ugly background :D)
i wuold like to see them
ciao:D
-
WOULD MAGNETOS WOULD NOT wuold..the last sentence..
MWHAHAHAHAHA..gotcha..
:D :D
mad_sci
-
oh yeah ... oh yeahhh i did that on purpose man !!
i knew somebody would notice ahahahahahhahahhhhhhh
yeah nice save :D:D
its not my fault i live in new york hi hi hi ....:D
-
Bronx here all the way...:D :D
let me make a sugestion of you fla..I was actually writing the tut on that..
1) make one big MC on the stage..the key frames will be the different rooms..so..
2) kreate a map of the floor on papper
3) name each room from 01-99 if you wish.
4) in the hero code the rooms like.
hall=new Array();
hall[1]= new Array (01,02,03,00,00,00,00);
hall[2]= new Array (00,04,05,00,00,00,00); etc..
then :
function call_room (hall,room);
each time you hit your line just render a new room..above.
you can walk from room 01-->02 from there:
01<--02--->03, and from 02-->04 etc..etc..
see my point..
mad_sci
-
thanks mad
i still have some hard time understanding arrays syntax in actionscript that s why i avoid them if i can but ultimately i'm gonna have to use them sigh......
look forward to see your tutorial
by the way what's papper?? :D
-
%$#%$#^%%%%%%..:D
ok here is how array work..
first you define the array
1) room=new Array();
2) room=new Array(magnetos,mad_sci); so
room[1]=magnetos; room[2]=mad_sci; or you can do:
room=new Array();
room[1]="some stuff";
room[2]="other stuff"; etc..
this how you build 2 dimentional array;
room=new Array();
room[1]=new Array(00,01,02); so..
room[1][1]=00;
room[1][2]=01;
or if you do a funtion will be;
house=new Array();
house[1]=new Array(00,01,02);
function render (hall,room){
frame=house[hall][room];
this.gotoAndStop(frame);
}
to call the function use;
house (1,2); will change the room to 01;;
easy,
mad_sci
-
ok hope you have time
bear with me
first you define the array
1) room=new Array(); //this tell flash that room is an array right??
2) room=new Array(magnetos,mad_sci);// shouldn t this line be
room=(magnetos,mad_sci); ? i mean why new Array is repeated twice?
as for the 2d array its a cool idea
i mean if you have a lot of halls and a lot of rooms
otherwise i 'd stick with the 1 dimensional array its simpler
i dont know if you will but i think it would be nice to make a small tutorial with some working sample on how arrays work especially for biginners like me........
may be i'll do it .... will see......
easy,
yeah easy for you
why wansn t i born a geniass :D
-
you can use the array in diff. ways..
way 1:
room=new Array();
room[1]="magneto";
way 2:
room=new Array(magnto); this is same as the above..
to put more elements you do:
way 1:
room=new Array();
room[1]="magneto";
room[2]="mad-sci";
// more writing here right..
way 2:
room= new Array(magneto,mad_sci); //same as the above..
now if you want to have 8 elements all of them eq. to magneto fo example:
room=new Array();
room[1]="magneto";
room[2]="magneto";
.
.
room[8]="magneto";
or
for (k=1;k<=8;k++){
room[k]="magneto";
}
ok?
mad_sci
-
God bless you man
let me know when is your birthday i ll get you something
a dictionary maybe :D :D
thanx again
-
Magneto this is the problem when you use all 10 fingers and 50 chars/min typing. Your brain tells you one thing, your fingers are typing somethig else, the eyes are telling you its wrong and Im too lazy to go back and redo..what to do, what to do..life..:D :D..
BTW I took TOEFL with not even one mistake..
mad_sci
PS as for the birthday think about something like Half-Life, or Max Payne..:D
[Edited by Mad-Sci on 02-06-2002 at 01:14 AM]
-
sheeesh yuo still use your fingers??
i am past that i use my toes (3 letters per minute but i am working on it:D)
-
Thanks!!!