class Star : ActionRole { static fun createRing( around : Actor ) { Star.createRing( around, "star" ) } static fun createRing( around : Actor, costumeName : String ) { val mainStage = Game.instance.scene.findStage( "main" ) val aroundRect = around.appearance.worldRect() val radius = Math.max( aroundRect.width, aroundRect.height ) val position = Vector2( (aroundRect.left + aroundRect.right)/2, (aroundRect.bottom + aroundRect.top)/2 ) val starCostume = Game.instance.resources.costumes.find( costumeName ) for ( a in 1..10 ) { val star = starCostume.createActor() star.position.set( position ) (star.role as Star).replaceAction( ForwardsBy( star.position, 2, radius, Angle.degrees( a * 36), Eases.easeOut ) and ScaleTo( star, 2, 2 ) and TurnBy( star.direction, 2, Angle.degrees(360) ) and Fade( star.color, 2, 0 ) ) mainStage.add( star ) } } }