class Drip : ActionRole() { @CostumeAttribute var isAcid = false var speed = 0.0 override fun createAction() : Action { return this:>move.action() } fun move() : bool { val play = Play.instance speed -= play.gravity speed *= 0.995 // Drag - stops the drips getting too fast actor.y += speed if (play.overlappingSomethingDeadly( actor ) != null) { splash() return true } val ship = play.ship if (ship != null && PixelOverlapping.instance.overlapping( actor, ship.actor ) ) { splash() if (isAcid) { ship.explode() } } return false } fun splash() { actor.event( "splash" ) for ( i in 0..6 ) { actor.createChild( "droplet" ) } actor.die() } }