# Jumping that jumps to the side ur sprite was facing

**URL:** <https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361>\
**Category:** programming\
**Created:** [August 27, 2004, 4:50am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361 "2004-08-27T04:50:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![KrustyJoe](https://avatars.discourse-cdn.com/v4/letter/k/fbc32d/32.png) [@KrustyJoe](https://forum.kirupa.com/u/KrustyJoe)\
**Post date:** [August 27, 2004, 4:50am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/1 "2004-08-27T04:50:31Z")

</div>

hello i am semi- new to flash and i am creating a platform game and i am using this script on my main sprite for direction.

if (Key.isDown(Key.RIGHT)) {  
\_root.mainsprite.gotoAndstop(2);  
}  
if (Key.isDown(Key.LEFT)) {  
\_root.mainsprite.gotoAndstop(3);  
}  
if (Key.isDown(Key.UP)) {  
\_root.mainsprite.gotoAndstop(4);  
}  
}

in the MC “mainsprite” -FRAME 1 - sprite facing right still  
FRAME 2 - sprite walking right  
FRAME 3 - sprite walking left  
FRAME 4 - sprite jumping right

As u can see, when my man jumps the sprite faces the rightside even when my sprite is jumping to the left.

I would like something like this:

[http://www.gotoandplay.it/\_articles/2003/12/scrolling\_upd.php](http://www.gotoandplay.it/_articles/2003/12/scrolling_upd.php)

And i have downloaded the source file… i try not to let others do my work but i tryed extracting parts from it that would help me but nothing worked.

Thanks in advance

-Mike

---

<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:** [August 27, 2004, 5:39am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/2 "2004-08-27T05:39:57Z")

</div>

```auto
if (Key.isDown(Key.RIGHT)) {               
  _root.mainsprite.gotoAndstop(2);
 }
 if (Key.isDown(Key.LEFT)) {
  _root.mainsprite.gotoAndstop(3);
 }

```

just replace that code with this…

```auto
 if (Key.isDown(Key.RIGHT)) {               
  _root.mainsprite.gotoAndstop(2);
_root.mainsprite._xscale = 100;
 }
 if (Key.isDown(Key.LEFT)) {
  _root.mainsprite.gotoAndstop(2);
_root.mainsprite._xscale = -100;
 }

```

there is no need for 2 different frames for direction. You can just FLIP the current graphic using xscale.

hope that helped

---

<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:** [August 27, 2004, 5:46am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/3 "2004-08-27T05:46:43Z")

</div>

k bout wat about my dude jumping…

how would i adjust it to that…

tats wat i really need

would it be something like this

if (Key.isDown(Key.LEFT)) { (Key.isDown(Key.UP)) }  
\_root.mainsprite.gotoAndstop(4);  
\_root.mainsprite.\_xscale = -100;  
}  
if (Key.isDown(Key.RIGHT)) { (Key.isDown(Key.UP)) }  
\_root.mainsprite.gotoAndstop(4);  
\_root.mainsprite.\_xscale = 100;  
}

i dun know if that would work… i’ll try

---

<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:** [August 27, 2004, 5:50am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/4 "2004-08-27T05:50:43Z")

</div>

i cant get it to work, you know wat i meen… it isnt going

---

<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:** [August 27, 2004, 6:19am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/5 "2004-08-27T06:19:22Z")

</div>

k ill make up a little FLA for ya.

::EDIT::

k there u go

---

<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:** [August 27, 2004, 6:26am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/6 "2004-08-27T06:26:02Z")

</div>

thanks…

when im finished my game, ur getting a shoutout for sure under credits

---

<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:** [August 27, 2004, 6:28am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/7 "2004-08-27T06:28:46Z")

</div>

no worries dude.

---

<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:** [August 27, 2004, 6:43am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/8 "2004-08-27T06:43:56Z")

</div>

you see im actually trying to make a platform game but i trying to take a few features on scrolling and walking from this fla here

[http://www.gotoandplay.it/\_articles/2003/12/scrolling\_upd.php](http://www.gotoandplay.it/_articles/2003/12/scrolling_upd.php)

and im somehow trying to combine the hittest features from this one

[http://www.gotoandplay.it/\_articles/2003/11/platform.php](http://www.gotoandplay.it/_articles/2003/11/platform.php)

reeasons : hittest on first one doenst really work for things tat are floating in the air…  
- scrolling on first can be used to make larger maps divided into 2 parts which i need  
- player movements on the first one are the best

---

<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:** [August 27, 2004, 6:47am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/9 "2004-08-27T06:47:41Z")

</div>

sorry i didnt realize till that previous post that the link from my first post didnt work.

the top link above shows amzing charactor control and is wat im trying to get…

- nottice how depending on the direction the dude is facing the guy jumps that way…
- thats wat ive been trying to get but have failed constantly

---

<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:** [August 27, 2004, 6:51am UTC](https://forum.kirupa.com/t/jumping-that-jumps-to-the-side-ur-sprite-was-facing/62361/10 "2004-08-27T06:51:00Z")

</div>

ppp… dude sorry i didnt see that u could jump on urs… my mistake…

i was pushing control and i was like

hmm… this isnt wat i wanted…

but then as i was exploring ur charcter i noticed the jump frame so i now know…

sorry bout hassle and thanks for help…

next stop : trying to get my map to scroll like those above
