Enemy Shooting AI Algorithm

  • 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.

    <img src="http://weedkiller.atomace.com/images/CSAI.JPG" border="0">

    I welcome your advice <img src="smileys/smiley1.gif" border="0" align="middle">

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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)

    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 over

  • 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 <img src="smileys/smiley1.gif" border="0" align="middle">

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

    Thanks once again,

    Aron

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)