class DripFactory : ActionRole { @Attribute var fromSeconds = 3.0 @Attribute var toSeconds = 6.0 override fun begin() { // Move the actor, so that it isn't overlapping a rock etc. // This allows us to be slap-dash in the SceneEditor, and yet we can still pick it up safely. val play = Play.instance while( play.overlappingSomethingDeadly( actor ) != null ) { actor.y -= 2 } actor.hide() super.begin() } override fun createAction() : Action { return Delay( Rand.between(fromSeconds, toSeconds) ) thenOnce this:>createDrip then RecreateAction( this ) } fun createDrip() { // There are two costumes "drip" and "acidDrip" // "drip" has two *different* child costumes (depending on the acidOption) // "acidDrip" has the same costume for both. val event = if (Options.instance.moreAcid == 0) "drip" else "dripAcid" actor.createChild( event ) } }