Enemy Shooting AI Algorithm

Get help using Construct 2

Post » Sat Nov 05, 2011 11:14 pm

Hi guys,

I'm working on a platform game (named Weed Killer) and need an enemy shooting AI algorithm. So far the forums have not had what I need and the internet provides some formulas for vectors but could not work out how to implement it in Construct2. Has anyone worked this out so far?

Here is a link to what I have so far... WeedKiller.AtomAce.com


This is what I wan to do...
Have our player who can run and jump,
and an evil green cacti monster who is static and shoots some pinkish orbs at our player.



I welcome your advice
B
21
S
5
G
6
Posts: 13
Reputation: 4,313

Post » Sat Nov 05, 2011 11:52 pm

[code]Player.X >= EnemyCactus.X-100   -> set EnemyCactus.Active to True

Player.X <= EnemyCactus.X+100   -> set EnemyCactus.Active to True

Is Active
Every 2.0 seconds
            -> EnemyCactus Spawn Sprite 4 on layer 1
            -> Set Bullet angle to angle(EnemyCactus.X,EnemyCactus.Y,Player.X,Player.Y)
            -> wait 0.2 seconds
            -> EnemyCactus Spawn Sprite 4 on layer 1
            -> Set Bullet angle to angle(EnemyCactus.X,EnemyCactus.Y,Player.X,Player.Y)
            -> wait 0.2 seconds
            -> EnemyCactus Spawn Sprite 4 on layer 1
            -> Set Bullet angle to angle(EnemyCactus.X,EnemyCactus.Y,Player.X,Player.Y)[/code]

And seriously, if you did really try to search a little bit, you would have seen that a topic like that was on the same page
http://www.scirra.com/forum/enemy-detect-player-and-shoot_topic45879_post287309.html#287309
So be carefull it's annoying to say the same thing over and overYann2011-11-05 23:53:59
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Nov 08, 2011 8:26 pm

Thank you Yann,


Missed the previous post that had the same thing, I did search the forums and goggled to find the algorithm for doing the same thing with vectors, then got confused! So I asked if anyone had solved this and you had

I went on to implement your solution for the game, here is the demo again: http://weedkiller.atomace.com/


Thanks once again,

Aron
B
21
S
5
G
6
Posts: 13
Reputation: 4,313


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests