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:
if <<[left arrow v] key pressed?> and <not <[right arrow v] key pressed?>>> your script else if <[right arrow v] key pressed?> your script end end
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:
when gf clicked forever if <key [left arrow v] pressed?> your script end if <key [right arrow v] pressed?> your script. end endThat should work a little better. It's also a bit more professional and traditional.
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
if <<key [left arrow v] pressed?> and <key [right arrow v] pressed?>> use whatever script you want to make the sprite stand still or do the idle animation, or whatever endThat should help with the animation problem.
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:
if <<key [left arrow v] pressed?> and <not<key [right arrow v] pressed?>>> move left end if <<key [right arrow v] pressed?> and <not<key [left arrow v] pressed?>>> move right end if <<key [left arrow v] pressed?> and <key [right arrow v] pressed?>> don't move and use standstill costume/animation end
Offline
when gf clicked if <key [right arrow pressed v]?> move (10) steps
Last edited by maxamillion321 (2012-08-26 18:20:19)
Offline
if <key [right arrow v] pressed?> move right else if <key [left arrow v] pressed?> move left end end
Offline
Molybdenum wrote:
if <key [right arrow v] pressed?> move right else if <key [left arrow v] pressed?> move left end end
This ahas already been suggested, and ruled out.
Offline