Enemy's Shooting each other with same bullet sprite

0 favourites
  • 2 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • Hey Everyone. I am very new to making games and Construct in general. At the moment I have two enemies that once they are in Line of Sight of the Player will fire a bullet. However I want that bullet to be able to destroy the enemy as well as the player if hit. My issue right now is that the enemy destroys it self as soon as it fires the bullet. How can I fix this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are a couple ways to get around this. You can just spawn the bullet a few pixels out of the bounding box of the enemy.

    However, a better solution would be to give the bullet a variable called "Creator". And when anything spawns a bullet, set its Creator variable to "self.UID". And then, when the bullet and the enemy collide, compare if bullet's Creator variable is equal to the enemy's UID, if it isn't, destroy the enemy.

    The second solution is better because the enemy will sometimes still destroy itself with the first solution.

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