# Jump

**URL:** https://forum.kirupa.com/t/jump/14079
**Category:** flash
**Created:** [February 21, 2003, 6:11pm UTC](https://forum.kirupa.com/t/jump/14079 "2003-02-21T18:11:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yarden](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yarden](https://forum.kirupa.com/u/yarden)
#### Post date: [February 21, 2003, 6:11pm UTC](https://forum.kirupa.com/t/jump/14079/1 "2003-02-21T18:11:26Z")

</div>

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

so I do this code:

```auto
// 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:

```auto
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…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 21, 2003, 6:40pm UTC](https://forum.kirupa.com/t/jump/14079/2 "2003-02-21T18:40:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 21, 2003, 6:54pm UTC](https://forum.kirupa.com/t/jump/14079/3 "2003-02-21T18:54:57Z")

</div>

if(keyPress(key.UP))

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 21, 2003, 7:55pm UTC](https://forum.kirupa.com/t/jump/14079/4 "2003-02-21T19:55:41Z")

</div>

mojoNYC

I want with the key…

playamarz

?
