Jump

I want to do a men that jump when I press up…

so I do this code:

// definitions for the moving spaceship
on (keyPress "<left>")
{
	if ( ( this._x > 0))
	{
		this._x = this._x - 20;
	}
}

on (keyPress "<right>")
{
	if ( ( this._x < 570))
	{
		this._x = this._x + 20;
	}

}
on (keyPress "<up>")
{
	if ( ( this._y > 175))
	{
		this._y = this._y - 20;
	}

}



how can I do that when I press up he do What I say to him:

on (keyPress "<up>")
{
	if ( ( this._y > 175))
	{
		this._y = this._y - 20;
	}

}

and after he do this he retun to y=400…
and the X stay in is place…

thanks

pls replay in easy english that I can understand you…

i’m not sure how it works w. keyPress, but if you were using a mouseDown to make the character ‘jump’ like this:

on(mouseDown){
characterMC._y -=10;
}
on(mouseUp){
characterMC._y+=10;
}

you can try to add the mouseUp and see what happens…
another idea may be to add some frames, have the keyPress trigger a gotoAndPlay in that MC, and then have a frame action that returns the characterMC to its orig y position.
hope this helps…
-mojo

if(keyPress(key.UP))

mojoNYC

I want with the key…

playamarz

?