This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-03 13:12:44

Indiego
New Scratcher
Registered: 2012-02-27
Posts: 61

Pacman movement help

Hi all,
Im in the process of making my first game - a game based on pacman - and this is my current version: http://scratch.mit.edu/projects/Indiego/2370853
My problem is the movement of the pacman, at the moment he only moves if you keep the button held, and it can be a bit glitchy sometimes,

is there any way to make him move, and keep moving in that direction, until another key is pressed or he hits a wall (and then stops).
I tried a few different ways and nothing seems to be working for me  sad
Any help would be greatly appreciated  big_smile

Offline

 

#2 2012-03-13 15:20:38

wasabi56
Scratcher
Registered: 2012-02-10
Posts: 500+

Re: Pacman movement help

For moving:

when gf clicked
forever
   move 2 steps
end
For turning:
when gf clicked
forever
   if (key [right arrow v] pressed)
   point in direction [90 v]
end
   if (key [up arrow v] pressed)
   point in direction [0 v]
end
   if (key [left arrow v] pressed)
   point in direction [-90 v]
end
   if (key [down arrow v] pressed)
   point in direction [180 v]
end
don't know at the time how to do the wall sensing


http://i.picasion.com/pic58/c23d4d2fc75f459dcf3d9ebf3e8ba395.gif
http://www.weebly.com/uploads/1/0/1/4/10146167/2294523_orig.png

Offline

 

#3 2012-03-13 15:28:47

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Pacman movement help

wasabi56 wrote:

For moving:

when gf clicked
forever
   move (2) steps
end
For turning:
when gf clicked
forever
   if (key [right arrow v] pressed?)
   point in direction [90 v]
end
   if (key [up arrow v] pressed?)
   point in direction [0 v]
end
   if (key [left arrow v] pressed?)
   point in direction [-90 v]
end
   if (key [down arrow v] pressed?)
   point in direction [180 v]
end
don't know at the time how to do the wall sensing

Think I fixed it.

Offline

 

#4 2012-03-14 07:46:37

cbhattarai
New Scratcher
Registered: 2012-02-11
Posts: 7

Re: Pacman movement help

Which Language are you using and on what platform are you making the game on?

Offline

 

Board footer