PDA

View Full Version : moving character


MatchbookRomance
11-01-2004, 07:51 PM
I have it so the main character moves with the arrow keys. But how can i make it so that he STOPS moving, when you press a pause button? So that the arrow keys will do nothing when its paused?

eatmorchikin6464
11-01-2004, 07:59 PM
Make a pause button then use this action:

on(release){
and then here you can either try stop(); or you might have to do your buttons again and be like
if(keyIsDown(Key.DOWN)){
_this.y+=0;
}

That way he wont move anywhere.

MatchbookRomance
11-01-2004, 08:14 PM
but if you put stop() it doesnt stop the MC from moving, it just stops the frame from playing. The MC is still able to move.

eatmorchikin6464
11-02-2004, 09:29 AM
I know, that is why I gave you the other option the one where you don't let it move. If you have an animate character, you will also need to say something along:

tellTarget ("character") {
stop;
}

then, to make it so that once it is on paused you should use }else{

so, the final code would read(and this is correct as in there are no mistakes)-


if (Key.isDown(Key.PAUSEBUTTON)) {
if (Key.isDown(Key.RIGHT)) {
this._xscale = 100;
this._x = this._x+0;
tellTarget ("character") {
stop;
}
}
}



NOTE- I dont know if this actually works, I just know that it is free of errors.

The Brown Cow
11-02-2004, 10:07 AM
Simple.

Make a variable that store the state of the game: paused or running. If it's not running, we ignore input.
if (_root.running) {
// The rest of your code
}

MatchbookRomance
11-02-2004, 03:58 PM
thanks brown cow, that worked nicely :)

eatmorchikin6464
11-02-2004, 05:01 PM
ARG! I hate you TBC (just kidding) Why is it that you are always right in answering his questions and it is always you he thanks. I tried give me some recognition for that atleast. LOL

MatchbookRomance
11-02-2004, 05:32 PM
because his replys are easy to follow haha. not like "oh, do this code... or soemthing like that" lol. thanks for... trying to help? is that what you wanted? haha

The Brown Cow
11-02-2004, 06:04 PM
I've looked at a lot of ActionScript, so I know how to do a lot of things with it. Right answers get thanks.


Well, um... I appreciate your help, EMC. :D

eatmorchikin6464
11-02-2004, 07:27 PM
YAY! Well, mine prolly would have worked, I havent tried it.