class Ship : Item { override fun activated() { super.activated() // Add extra solid pieces, so that you cannot walk through the legs of the ship. (actor.createChild( "leg" ).role as Item).move( 1, -1 ) (actor.createChild( "leg" ).role as Item).move( -1, -1 ) } fun launch() { val velocity = Vector2( 0, 1.0 ) val acceleration = Vector2( 0, 16.0 ) actor.event("launch") replaceAction( ( this:>scrollUp.action() and Move(actor.position, velocity) and Accelerate( velocity, acceleration ) and this:>createFlame.action() ).forSeconds(14) thenOnce Game.instance:>startScene.curry("menu") ) } fun scrollUp() : bool { Play.instance.mainView.worldFocal.y += 1 return false } fun createFlame() : bool { for (i in 0 until 5) { actor.createChild("flame").zOrder = actor.zOrder - 1 } return false } }