Author |
Message |
implosion
|
Posted: Tue May 27, 2008 6:44 pm Post subject: Simple AI help ? |
|
|
can someone show me an example of a simple code (for BlueJ) that has an AI that has a picture value to it and make it move across the screen from left to right so i can get a base started for making my own AI ? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Reality Check
|
Posted: Tue May 27, 2008 8:07 pm Post subject: Re: Simple AI help ? |
|
|
You need to be more specific. I assume you have a picture of some enemy or something that you want to move based on your location? For me to help you with a specific AI I need to know what type of game/program you are making. A very simply one though:
You have a paint method with your draw function with x and y as variables. In other methods or your program you'd alter x and y based on what you want it to do and then update with your new x and y variables. I want write for you any specific code though, that has to be one on your own |
|
|
|
|
|
A.J
|
Posted: Tue May 27, 2008 8:55 pm Post subject: Re: Simple AI help ? |
|
|
cud u explain this game of yours please, so I can help u |
|
|
|
|
|
implosion
|
Posted: Tue May 27, 2008 8:55 pm Post subject: Re: Simple AI help ? |
|
|
The kind of game that we're trying to produce is a Tower Defense... you have guys coming from one end to the other and you set up towers to kill them. i don't want all the work done, but enough information to get me started. our programmer teacher isn't here anymore and we have a supply that doesn't know much about BlueJ |
|
|
|
|
|
Tony
|
Posted: Tue May 27, 2008 9:18 pm Post subject: RE:Simple AI help ? |
|
|
Well the "AI" requires to know the shortest path from the spawn point to the exit point, and it follows that path on the screen. Look into the A* (A-star) algorithm |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
cavetroll
|
Posted: Tue May 27, 2008 9:22 pm Post subject: RE:Simple AI help ? |
|
|
I don't really know Java so I can't give you any code. However, couldn't just use waypoints and advance the unit to the next waypoint and then repeat? I would think that would work, unless of course the assignment is not so much the game as the pathfinding. |
|
|
|
|
|
btiffin
|
|
|
|
|
Tony
|
Posted: Tue May 27, 2008 9:34 pm Post subject: Re: RE:Simple AI help ? |
|
|
cavetroll @ Tue May 27, 2008 9:22 pm wrote: couldn't just use waypoints and advance the unit to the next waypoint
Not if there's a defense tower build in between the waypoints. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
A.J
|
Posted: Tue May 27, 2008 9:54 pm Post subject: Re: Simple AI help ? |
|
|
ask fishtastic (a user on compsci).
he made an AMAZING tower defense (but its on turing though)
I can help u with anything u need in A*, but he can help u with the rest (and also A*) |
|
|
|
|
|
tenniscrazy
|
Posted: Wed May 28, 2008 7:38 am Post subject: RE:Simple AI help ? |
|
|
ya, his tower defense is what gave us the idea
thanks for the help and suggestions. I think we have an idea what to do now |
|
|
|
|
|
|