Results 1 to 3 of 3

Thread: wall stop

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Location
    netherlands
    Posts
    3

    wall stop

    hey,

    I am trying to make some kind of pacman game, but I have no idea how to stop my pacman from going trough the walls.

    I am using pictureboxes for pacman and for the walls. Is there some kind of code for this?

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: wall stop

    Shouldn't be a problem. The figures move in a straight line either vertical or horizontal. So if you have a tunnel let's say with wall on both sides then your figures need to move up/down and left/right without touching the walls. If you just make the center line of a figure move on top of the center line of the tunnel then they should never "go through the walls"


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: wall stop

    Take a look at my A* Pathfinding in my signature. Not only will this help with wall collision, but also give you a nice chase algorithm for your ghosts. It also has not just pathfinding but pathfollowing as well.

    [EDIT] Also don't use a bunch of pictureboxes to setup the worlds. Its better to actually work with graphical APIs or even DirectX.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width