GML Bullet Collision

Discussion in 'Programming' started by Captain_ArrowWound, Feb 10, 2019.

  1. Captain_ArrowWound

    Captain_ArrowWound Member

    Joined:
    Jan 19, 2019
    Posts:
    29
    I am making a game where players and enemies both fire bullets. If they hit a tree, rock or something like that the bullets are destroyed. This takes a while to do because I have to implement it in each object by adding instance_destroy in the object collision event. I'm wondering if there is a easier way for me to do this?
     
  2. Danei

    Danei Member

    Joined:
    Mar 23, 2018
    Posts:
    235
    Use a parent object named obj_terrainParent or something, and put your code in that, and make all the objects that you want to behave this way children of that parent object.
     
    Toque and CameronScottCreations like this.
  3. Captain_ArrowWound

    Captain_ArrowWound Member

    Joined:
    Jan 19, 2019
    Posts:
    29
    Thanks I did that and it works perfectly!
     
    Danei likes this.
  4. Captain_ArrowWound

    Captain_ArrowWound Member

    Joined:
    Jan 19, 2019
    Posts:
    29
    One question though, is there any function that acts as within. Such as if collision with bullet, destroy bullets within a certain range.
     

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