Help! destroy Object On Collision After Some Time UPBGE

Hello Everyone, I wanted Some Help Iam trying To make A Game in UPBGE where When You Collide with An Object After Some Time The Object Gets Destroyed. Can Anyone Help Me !

Here is a simple example, hope it helps :slight_smile:

Collision_EndObject.blend (510.1 KB)

1 Like

Thanks For Your help. But Unfortunatley What You Sent Me Was not What I Meant. What i wanted Was When The Object Detects Collision It then Waits a certain Time Then it Destroys itself. The Delay Only Starts When The Collision Happens. But in What You Sent Me The Delay Starts Even If The Collision Doesn’t Happen. And Again Thanks For Your Help.

EDIT: My bad. Whenever I Try It From Your Blend File It works As Expected. But When i Implement it in my Game It’s Messed Up Thank You For Your Help

1 Like

I don’t know upbge, but in blender logic I would just set the collision to make the object to change state, and that state would have a delay that is connected to an end object.

I really don’t know if this is helpful… so good luck

If your talking about UPBGE 0.24, just use a BGE kind-of script that has the elements -

(This is a rough-draft example & not real code)

(NEEDED THINGS)
#VARIABLE
TIME = 60 (seconds)
#THESE GAME-PROPERTIES ON PLAYER (2)
(Boolean) "Collided" 
(Integer) "End Timer"

1. Object (1) hits Object (2) --> Object (2) property called "Collided" = True
2. If Object (2) property "Collided" == True --> Object (2) property "End Timer" + 1
3. If Object (2) property "End Timer" == TIME --> Object (2) is DESTROYED.

I’m not writing you a real script not because I don’t know how to - I most certainly do - You need to learn how to make your own scripts.

Thank You So Much For Your Help!

1 Like

Thanks So Much ! i’ll try it out And see If it works