class BallDestroyer : ZilchComponent { [Property] var SpawnTime : Real = 5.0; function Initialize(init : CogInitializer) { Zero.Connect(this.Space, Events.LogicUpdate, this.OnLogicUpdate); Zero.Connect(this.Owner, Events.CollisionStarted, this.OnCollision); } function OnLogicUpdate(event : UpdateEvent) { this.SpawnTime += event.Dt; if (this.SpawnTime > 4) { this.Owner.Destroy(); } } //Destroys the ball when collides with player function OnCollision(collisionEvent:CollisionEvent) { //Change PlayerMovement to what ever the script on your player is if(collisionEvent.OtherObject.PlayerMovement != null) { this.Owner.Destroy(); } } }