Jumping that jumps to the side ur sprite was facing

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

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

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

just replace that code with this…

 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

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

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

k ill make up a little FLA for ya.

::EDIT::

k there u go

thanks…

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

no worries dude.

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

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

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

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

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