class ThumbButton : SceneButton { fun isUnlocked() = DodgeEm.instance.isUnlocked( scene ) override fun begin() { super.begin() } override fun activated() { if (actor.stage == null) return super.activated() if ( isUnlocked() ) { var medals = DodgeEm.instance.sceneMedals( scene ) if ( medals > 3 ) medals = 3 if ( medals > 0 ) { val medalA = actor.createChild( "medals" + medals ) medalA.x += 60 medalA.y -= 15 medalA.zOrder = 200 medalA.stage = Game.instance.scene.findStage( "glass" ) // Move it above the live thumbnail. } } else { val w = actor.appearance.width() val h = actor.appearance.height() actor.event( "locked" ) enabled = false actor.x += (w - actor.appearance.width()) / 2 actor.y += (h - actor.appearance.height()) / 2 } } override fun onClicked( event :MouseEvent ) { if ( isUnlocked() ) { Game.instance.startScene( scene ) } } }