Pages: 1
Topic closed
http://scratch.mit.edu/projects/redman123/1810674
I am still working on the movement of the main character. However, it seems that there is a giltch. When I press "right arrow" and "space", it will jump forward and land. While it reaches the ground , if I press left arrow I will jump backward immediately. Can anyone help me with the de-bug ? Or show me a better to re-program which has better result.
P.S The giltch doesn't happen when I jump left and press "right arrow" when it reaches the ground.
Offline
I think the glitch is in the Jumping script. The script first checks to see if the right key's pressed to jump to the right, then after the script's finished jumping right it checks to see if the left key's pressed, and the sprite will jump if the left key's pressed at that time.
Maybe if you separated the scripts it wouldn't happen, for example, make two scripts that respond when you press space and use <if><<<key[ left arrow ]pressed?> <and><< <not> <key[ right arrow ]pressed?> >> >>
and
<if><<<key[ right arrow ]pressed?> <and><< <not> <key[ left arrow ]pressed?> >> >>
I think those would make sure that you can't press both at once and make a glitch, and that the person won't jump if you're pressing a key after landing....or you could use the glitch as a part of your game, and pretend that you did it on purpose?
Last edited by Flait7 (2011-05-25 13:45:30)
Offline
thanks a lot , man. I have sloved my problem. By the way,
I noticed that when I kept holding down space bar [jump], the sprite would keeping jumping. Is there a way that I can set the "jump" only works one time when I hold down the button and don't let go ? and when I release space bar and hit space bar again. the spite jumps ?
Offline
Topic closed
Pages: 1