im trying to make a capture the flag type thing and i want it to be one player, so how do i make it so the computer will be the opponent and respond to whatever the person playing it does? sorta like when u play checkers on ur ipod or whatever the ipod 'thinks' like a couple of moves ahead, sorta like that!
i already figured out how to make the sprite move when someone presses the arrow keys, i just need to find how to make it go for as long as the arrow keys are pushed.
i know that was confusing but someone please help me!
Offline
Maybe look at this article about the computer players.
Offline
Hmm, it sounds like what your doing is pretty complex. If your goal is for the computer opponent to try to "tag" the player, use a script like this:
[blocks]
<when green flag clicked>
<forever>
<point towards( Player )>
<move( 10 )steps>
[/blocks]
(You can change the number of steps it moves to whatever you want.)
If you want a script for the computer that try's to run away from the player, try a script like this:
[blocks]
<when green flag clicked>
<forever>
<point towards( Player )>
<turn cw(180 )degrees>
[/blocks]
(this script will work best in full screen mode)
I hope that helps you!
Silvershine
Offline
The checkers method of thinking ahead is by using a game tree. This wouldn't work for a capture the flag type game, there are simply too many possibilities
Example: 2 people on each team can all move 4 directions, so in each given frame, there is a combination of 16 different "moves". To think 8 frames ahead, there are 16^8 or about 4.3 billion possibilities to be looked at, and no computer can handle that every frame!
Instead, I would base my AI off of distance between the opponents, the opponents' flag, and the center line.
Offline
Ai codes use vaiables and random factors so if you don't know variables you can't make an ai for my ai project boss battles the biggest problem i have is making the computer less invincible without put an increased wait time on all attacks which would pretty much make the computer player an easy target for attacks
P.S. the trick to beating my ai is to stay in the air because even though i made a script to defend it from air attacks it activates the script at random times.
Offline