GML Visual Destroying an Instance when Collision Stops Happening

D

DarkCaelestis

Guest
Hello, I'm very new to GameMaker DnD and programming in general. I'm creating an object that spawns an instance of a different object above it, but I would like the instance it creates to destroy itself once the player walks away. How would I go about this? I can only get the instance to create but not destroy itself once collision ends.
 

marasovec

Member
Code:
Collision event with player -> set alarm[0] to 2
alarm[0] event -> Destroy instance
Basically the Collision event keeps the alarm turned on until you stop colliding with it. Then the timer runs out and the object destroys itself
 
D

DarkCaelestis

Guest
Code:
Collision event with player -> set alarm[0] to 2
alarm[0] event -> Destroy instance
Basically the Collision event keeps the alarm turned on until you stop colliding with it. Then the timer runs out and the object destroys itself
How would I set that up with Drag & Drop? I can't figure out what boxes would help me destroy the instance I created when two different objects aren't colliding.
 
D

DarkCaelestis

Guest
Nevermind! I figured it out. I had to use the "Apply To" box to the object I wanted and then destroy instance.
 
Top