Im trying to make a pac man clone, writing a script for my pacman sprite to move in the direction of the arrow key pressed. the issue im having is the costumes are not switching correctly and when i use the point in direction block it moves the sprite diagonal a little bit before pointing in the direction. I want him to change to the right direction but i dont want to sprite to shift slightly every time you do. so when i do this with all 4 arrow keys only 2 change costumes and they dont change to the correct costume specified in the block, it does move in the correct direction 10 steps but like i said early it moves diagonal first. i checked out the different costumes and when i cycle through them they seem to be ontop of one another so i dont think it has to do with a costume sprite being in a slightly different position.
script is
when (left arrow) clicked
switch costume (sprite right)
point direction (right)
move (15) steps
any ideas?
Offline
cr3al wrote:
Im trying to make a pac man clone, writing a script for my pacman sprite to move in the direction of the arrow key pressed. the issue im having is the costumes are not switching correctly and when i use the point in direction block it moves the sprite diagonal a little bit before pointing in the direction. I want him to change to the right direction but i dont want to sprite to shift slightly every time you do. so when i do this with all 4 arrow keys only 2 change costumes and they dont change to the correct costume specified in the block, it does move in the correct direction 10 steps but like i said early it moves diagonal first. i checked out the different costumes and when i cycle through them they seem to be ontop of one another so i dont think it has to do with a costume sprite being in a slightly different position.
script is
when (left arrow) clicked
switch costume (sprite right)
point direction (right)
move (15) steps
any ideas?
i tried this out, and i looked like most pac-man games:
when green flag clicked
forever
move 10 steps (less if you want it slower)
if: ... key is pressed, point in direction 90, 0 -90, 180
switch to next costume (end if)
then do the ifs for the other keys,
hope this works for you
Offline
You will have to use seperate scripts. One script for the costume changing and 1 or 4 script(s) for the movement, because some people use hat blocks (the "when key ____ pressed" block).
To find out the solution quickest, i would look at the wiki or look how other people make the scipt that works.
Anywho, I hope you succeed in your Pacman game! Good luck!
Offline