/** Ejected from the Ship when it thrusts. */ class Puff : ActionRole { var ship: Ship fun begin( ship : Ship ) { this.ship = ship actor.direction = ship.actor.direction actor.moveForwards( 5 - ship.actor.appearance.height()/2) actor.direction = Angle.degrees( Rand.between( -20.0, 20.0 ) + ship.actor.direction.degrees + 180 ) val distance = actor.direction.vector() * Rand.between( 60, 100 ) distance += ship.velocity val seconds = 1.0 val action = MoveBy( actor.position, seconds, distance ).and(Fade( actor.color, seconds, 0)).then( Kill( actor ) ) actor.stage = ship.actor.stage actor.zOrder = ship.actor.zOrder -1 then( action ) } }