View Full Version : Game help (dunno what the topic should be)
medhopz
06-09-2006, 11:23 AM
hi all
new here-first post [=
so this is my problem
i got a MC
when u press the key directions he goes left right up and down
when hes going a direction i want an animation of him walking
i tried
if(Key.isDown(Key.RIGHT)) {
_root.man.gotoAndPlay("right")
r = true;
} else {
r = false;
}
I tried it and it doesnt work \:
tnx ahead
Freddy
06-09-2006, 12:18 PM
hmm..
Heres an idea.
In the MC (man), make another MC in the frame "right" of the guy walking to the right. So that in that new MC all the frames are his walking animation.
I think the problem you had is that every time you pressed RIGHT, it would go to the frame "right" but no go any further.
By having all walking stuff in an MC, when the main MC (man) goes to frame "right", it will have the new MC playing its walking animation.
That might be a bit hard to understand.
If someone else can put that into more easier terms for me...
The Brown Cow
06-09-2006, 12:18 PM
What's happening (probably) is that Flash is going to the first frame of the animation every frame you're pressing the button.
If you put your walking animation into a movieclip, and then put that clip on the "right" frame, you can gotoAndStop() to that frame, and it will loop the animation for as long as the button is pressed.
Freddy
06-09-2006, 12:19 PM
thanx BC ;)
The Brown Cow
06-09-2006, 12:21 PM
We actually posted at about the same time, but you're welcome. :)
Double click on the mans mc.
Add another frame.
Put another mc of the man runing right on that frame.
Highlight the frame in the timeline
open up the properties panel
find the spot called frame label
type in "right"
now double click away fro myour character to get back to the main timeline.
Add this to the guy
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this.gotoAndStop("right")
}
}
onClipEvent(keyUP){
this.gotoAndStop(1)
}
REpeat and make the frames for moving left up down ect
So you'll get:
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this.gotoAndStop("right")
}
if(Key.isDown(Key.LEFT)){
this.gotoAndStop("left")
}
if(Key.isDown(Key.UP)){
this.gotoAndStop("up")
}
if(Key.isDown(Key.DOWN)){
this.gotoAndStop("down")
}
}
onClipEvent(keyUP){
this.gotoAndStop(1)
}
medhopz
06-10-2006, 05:43 AM
aaahhh!!
tnx so much [=
its like the easist thing and i didnt think about ***stupid me***
tnx a lot
peace
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.