All right, I have a script that changes the X-Position by 3 if the right arrow key is pressed and one that changes the X-Position by -3 if the left arrow key is pressed on my sprite. The sprite runs when one if these keys is clicked and stops when it is released, going into an idle pose. But when I press both, the character's costume twitches between the standing costume and running one while jerking around. How do I solve this problem? Help would be greatly appreciated.
Offline
Use something like this:
ifandleft arrow ▼key pressed?notright arrow ▼key pressed?your scriptelseifright arrow ▼key pressed?your script
Last edited by ErnieParke (2012-08-21 20:36:57)
Offline
It kind of worked, the only problem is he runs backwards whenever i press the right key then the left one.
Offline
I think it's better to have:
That should work a little better. It's also a bit more professional and traditional.whenclicked
foreverifkeyleft arrow ▼pressed?your scriptifkeyright arrow ▼pressed?your script.
Last edited by henley (2012-08-21 21:18:56)
Offline
well... yes, that's my original script, but he only problem is that if i press both keys, he remains stationary, yet he makes a running animation.
Offline
DolphinSwarm wrote:
It kind of worked, the only problem is he runs backwards whenever i press the right key then the left one.
Is there some way for you to post all of your movement script or upload your project? That would help a lot.
Offline
Well, i'm not good with scratchblocks in the forums, but here it is: http://scratch.mit.edu/projects/DolphinSwarm/2741980
Offline
That should help with the animation problem.ifkeyandleft arrow ▼pressed?keyright arrow ▼pressed?use whatever script you want to make the sprite stand still or do the idle animation, or whatever
Offline
all right, thanks. I've tried that already, but I'll se how it goes.
Offline
Oh,and make sure it looks like this:
ifkeyandleft arrow ▼pressed?notkeyright arrow ▼pressed?move leftifkeyandright arrow ▼pressed?notkeyleft arrow ▼pressed?move rightifkeyandleft arrow ▼pressed?keyright arrow ▼pressed?don't move and use standstill costume/animation
Offline
whenclicked
ifkeyright arrow pressed ▼?move10steps
Last edited by maxamillion321 (2012-08-26 18:20:19)
Offline
ifkeyright arrow ▼pressed?move rightelseifkeyleft arrow ▼pressed?move left
Offline
Molybdenum wrote:
ifkeyright arrow ▼pressed?move rightelseifkeyleft arrow ▼pressed?move left
This ahas already been suggested, and ruled out.
Offline