Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Pacman ghost help

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Location
    Sandwich
    Posts
    14
    My Mood
    Yeehaw
    Thanks
    1
    Thanked 1 Time in 1 Post

    Question Pacman ghost help

    Alright so ive been making a pacman game and have came to doing the ghost. So far I have it were if they collide with a wall they will random generate a number to choose which way to go. The only problem is I need to make it turn with out colliding also. Does anyone have anyidea how to do this.


  2. #2
    Junior Member
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    20
    My Mood
    Bored
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: Pacman ghost help

    So your problem is that when the ghost hits a wall with the speed of 5px the ghost moves into the wall 5px before it chooses another direction?

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Location
    Sandwich
    Posts
    14
    My Mood
    Yeehaw
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Pacman ghost help

    no sorry i should of been more clear it more of something like this
    ...............#... #
    ................#...#
    ................#...#
    ......#####....#######
    ..................g
    ....... ##############
    if g is the ghost and # is the border(ignore the . ) i need to go up the path event thought it never collided but im

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    20
    My Mood
    Bored
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: Pacman ghost help

    You could check if there is a wall over the ghost.
    If not, it will "random generate a number to choose which way to go".

  5. The Following User Says Thank You to minju For This Useful Post:

    Daryn (November 9th, 2012)

  6. #5
    Junior Member
    Join Date
    Nov 2012
    Location
    Sandwich
    Posts
    14
    My Mood
    Yeehaw
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Pacman ghost help

    alright thanks i cant believe i didnt notice that earlier

Similar Threads

  1. Pacman issue with walls
    By mightyking in forum What's Wrong With My Code?
    Replies: 11
    Last Post: November 30th, 2011, 02:21 PM
  2. Making a pacman game having some problems with drawing
    By Matta in forum What's Wrong With My Code?
    Replies: 22
    Last Post: June 9th, 2011, 07:18 PM