// Information used to be animated, but is now fixed! class Information : ActionRole() { } /** Text, which is initially moved off the screen, and is then moved into place when [go] is called. */ class AnimatedInformation : ActionRole() { @Attribute( about="How much to move by to move from off-screen to the correct position" ) val moveBy = Vector2(0.0, -300.0) @Attribute( about="The time it takes the animation to move into the correct position" ) var seconds = 2.0 override fun activated() { actor.event( "default" ) // Pick new random text (if there are alternate texts) actor.scaleXY = 0.1 actor.hide() } fun go() { actor.show() replaceAction(goAction()) } fun goAction(): Action { return MoveBy(actor.position, 0, -moveBy * actor.stage.firstView().scale ) then ShowActor( actor ) then MoveBy(actor.position, seconds, moveBy * actor.stage.firstView().scale, Eases.easeOut) and ScaleTo( actor.scale, seconds, 1, Eases.easeIn ) } } // Sub-classes, so that we can find them using findRolesByClass class SceneComplete : AnimatedInformation() { } class TimeIsUp : AnimatedInformation() { } class YouLose : AnimatedInformation() { }