3
$\begingroup$

I'm making a Pac-Man clone to familiarize myself with the game engine and I can't figure out how to limit the area the player/enemies can move in without introducing other problems. If I use a navigation mesh they kind of slide around clumsily instead of moving in straight lines parallel to the the x/y axis like in the original Pac-Man.

I've made a simple mesh (highlighted in orange) that shows the paths the characters should travel over. Path is highlighted in orange

Is there any way I can restrict their movement so they're always located at some point on this path or am I better off just using a ton of logic bricks to handle each turn at each corner individually?

$\endgroup$
  • $\begingroup$ Can't think of a nice way tot do this with logic bricks without being hack. do you know Python? $\endgroup$ – Mike Pan Dec 2 '14 at 5:18
2
$\begingroup$

Have you tried incrementing motion? You might try using a setup like the one in the image below to increment the motion of the characters (Although you can set the frequency extremely low) and then adding a non-rendering collision mesh ahead of the character that rotates them when they're about to hit a wall.

Just set the motion value to the number of blender units per grid space on your map, an that should do it!

Screenshot demonstrating logic brick layout for incremental motion.

Hopefully this helps! Just a quick aside, if the motion winds up being too fast, try halfing the value for motion. That'll slow it down while still preserving the grid-based motion.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.