Enemy AI and Firing Range

This forum is currently in read-only mode.
From the Asset Store
It is a powerful and complete package containing a total of 20 enemy AI mechanics.
  • Hi All,

    I'm trying to create an enemy that has a custom firing range for each instance of aforementioned enemy. For example, I only want Enemy A to fire a missile whenever the player is within range of it. The problem I keep running into, however, is that if the player is within range of Enemy A, the firing behavior is triggered for Enemy B, C, and D.

    Is there any way I can do this without creating a unique enemy object for each enemy I want to place in my level?

    Thanks

    -Letaceo-

  • Is there any way I can do this without creating a unique enemy object for each enemy I want to place in my level?

    Of course this would work with instances of the same object. I guess you have a picking mistake in your event setup.

    Like this it would work for example for multiple instances:

    + Evil: Value 'Range' Greater or equal Distance(Evil.X,Evil.Y,Player.X,Player.Y)
    -> Shoot
    [/code:2doqwkrc]
    
    Evil being the Enemy sprite. Using the 'Compare a private variable' condition works great for picking here. It wouldn't work well if you used system compare for the same purpose.
    
    Obviously I don't know your events, but as I said you are probably doing something in a way that all instances actually get picked, although you don't intend to.
    
    Upload a cap or show your events if you're still having trouble with this.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That completely solved it. Many thanks.

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