PDA

View Full Version : [AS2] make my character walk


canarybirdfly
12-08-2008, 05:36 PM
Ok I have to program a game prototype and I have no idea where to begin.

Basically I will be wanting to make my character walk, I have a movie clip of him doing this but I was wondering if it was possible to have flash switch from one clip to the other when a keyboard button is pressed

So:
nothing plays still clip
up key plays jump clip
left key plays walk left clip
right key plays walk right
etc.

I have tried a few things but my scripting knowledge is still in development

Any help will be greatly appreciated!

Thanks in advance

Bod720
12-08-2008, 06:07 PM
onEnterFrame = function () {
if (Key.isDown("<Up>")) {
character_mc.gotoAndStop(2);
} else if (Key.isDown("<Left>")) {
character_mc.gotoAndStop(3);
} else if (Key.isDown("<Right>")) {
character_mc.gotoAndStop(4);
} else {
character_mc.gotoAndStop(1)
}
}

Obviously, though, you'll need to tweak it to exactly how you want it.