1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Need help with tower defense

Discussion in 'Programming' started by jaigantor, May 22, 2019.

  1. jaigantor

    jaigantor Member

    May 22, 2019
    Am trying to make it so that when an enemy collides with my object obj_EnemyDeath it is destroyed and I lose a life.
    currently on my enemy object I have created a collision instance and this is the code within

    with(other) instance_destroy(self);
    global.baah --;

    *baah being health just a wip name*

    it works for the first enemy that collides with obj_EnemyDeath but not for the rest of them,
    any help appreciated, thanks
  2. Guitarmike

    Guitarmike Member

    Jun 30, 2018
    If you created the collision on the enemy object then "other" is pointing at your obj_Enemy_Death and it gets destroyed before any other instances can collide with it. Either get rid of the with(other) or move your collision event to the obj_EnemyDeath.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice