I am currently working on a pacman game and I have a problem with diagonal movement. I don't want pacman to be able to move diagonally.
<when green flag clicked>
<forever>
<if> up key is pressed << <and> >> variable down arrow=not pressed << <and> >> right arrow not pressed << <and> >> left arrow not pressed <change y by(4 <point in direction(0)
ect. for the rest of the arrow keys; now I have motion.
<when green flag clicked>
<set{ variable up arrow to not pressed }
<set{ variable down arrow to not pressed }
<set{ variable left arrow to not pressed }
<set{ variable right arrow to not pressed }
now I can move when I click start.
<when green flag clicked>
<if> up arrow pressed <set{ variable up arrow }to( pressed
<if> up down pressed <set{ variable down arrow }to( pressed
<if> right arrow pressed <set{ variable right arrow }to( pressed
<if> left arrow pressed <set{ left arrow }to( pressed
when I clicked start I could still move diagonally like nothing happened. Can anyone spot a glitch in my codes or think of a better way to stop the diagonal movement?
Thanks,
Shigrammer
Offline
Thank you. I didn't realize that there was a demo on scratch.
Offline