Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need help with AI for pacman
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
maxxxpain




PostPosted: Sun Jan 14, 2007 11:12 am   Post subject: Need help with AI for pacman

sorry that i used "need help" but i just seriously needed help. I'm a stoner and i lack in logic, i just didnt no who to turn to for help and ISP is due in 3 days. All i need help with is to make the pacman follow me and thats all. Sorry that i posted an "i need help" post.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sun Jan 14, 2007 12:37 pm   Post subject: RE:Need help with AI for pacman

Why don't you attach the code you already have?

Basically what you'll need to do is check your position (the mouse? or what?) against the position of pacman. For example if the mouse is higher than pacman, you'll have to make him move up, as long as nothing is blocking the path in between.
maxxxpain




PostPosted: Sun Jan 14, 2007 1:27 pm   Post subject: Re: Need help with AI for pacman

this is my game so far


PacDisplay.t
 Description:

Download
 Filename:  PacDisplay.t
 Filesize:  11.78 KB
 Downloaded:  98 Time(s)

CodeMonkey2000




PostPosted: Sun Jan 14, 2007 2:13 pm   Post subject: Re: Need help with AI for pacman

Your enemy procedure should be something like this:
code:

procedure enemy
    if my x > enemy x and whatdotcolor (enemy x + 5, enemy y) not= green then
        enemy x += 5
    end if
    if my x < x2 and whatdotcolor (enemy x - 5, enemy y) not= green then
        enemy x-= 5
    end if
    if my y > enemy y and whatdotcolor enemy x, enemy y+ 5) not= green then
        enemy y += 5
    end if
    if my y < enemy y and whatdotcolor (enemy x,enemy x- 5) not= green then
        enemy y -= 5
    end if
    drawfilloval (x2, y2, 15, 15, 1)
end enemy

also whatdotcolour isn't the best solution to this problem. It is now imposible to do a cirular collision now.
Nova




PostPosted: Mon Jan 15, 2007 1:55 pm   Post subject: Re: Need help with AI for pacman

The ghosts in Pacman follow a pre planned path until it comes into proximity with the player
So you should have them going a pattern and if the you come into a short enough distance from them they chase you and leave their path
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: