The Daily Click ::. Forums ::. Klik Coding Help ::. 1) 8 dir. AI. 2) Path AI in a maze

Post Reply  Post Oekaki 

Posted By Message


8th August, 2003 at 23:31:07 -

I am making a game that you are in this big maze like arena (supposed to be some HQ or soemthing for bad guys) and the area is huge, but the screen size is small so its like a maze. There are enemies in it too, and thats where i have my trouble.

How can i give them AI so when they see me, or hear me shoot near them (i can scrap that idea if its too hard) they chase me, and attack, but somewhat smart. Also how can i have them chase me sorta, for a while, throuigh the 'maze' and not just smash into walls that im on the other side of.

Thanks so much to anyone that helps, im a newb and a half as you can tell from my posts, and the events to do this would be really really helpful, ill give rfull credit to whoever helps me out.



Possibly Insane

9th August, 2003 at 05:38:48 -

just use detectors

Beware of life far noone have survived it.......

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

9th August, 2003 at 05:46:38 -

OK, for hearing and seeing, it's easy. if you've got a maze, just have every enemy fire an active object every 0.5 secs or similar. if it collides with a background, destroy it, and if it collides with the player, then give chase.

for hearing, i would use pythagoras' therom. square root((x of player - x of solider) all squared + (y of player - y of solider) all squared)) and set that to an alterable value of the enemy. then have, if sound plays and Alt Value A of solider < 200, give chase.

for chasing, use something easy like "every 1 sec, look at (0,0) from player".

if the enemy collides with a wall whilst it is chasing, then compare the direction it is travelling with the position of the player. e.g.

+soldier collides with the background
+soldier is facing direction UP
+players' X pos is > soldiers' X pos
-Set direction of soldier to RIGHT.

you'll need to make it a little more advanced than this though, that's the basic princible. im writing an article on AI so stay tuned for that.

hope this helped.

Post Reply



Worth A Click