// A Valuable (meaning that it must be collected to complete the scene). // A flower starts out solid as far as Player (and other Items) // But when a Bee invades, the Bee is killed, and the Flower acts like a Coin // i.e. it becomes rounded, and collectable. class Flower : Valuable { var state = 0 // 1 = pollinating 2 = pollinated // Not collectable until it is pollinated by a bee. override fun collectable() = state == 2 // Becomes rounded when the flower turns into a pumpkin // This can cause rocks to roll off ;-) override fun rounded( direction : int ) = state == 2 fun pollinate() { state = 1 replaceAction( EventsAction( actor, 16, "pollinate1", "pollinate2", "pollinate3", "pollinate4", "pollinate5", "pollinate6" ) thenOnce this:>setPollinated ) } fun setPollinated() { state = 2 } override fun invaded( movement : Movement ) : boolean { if ( movement.item is Bee ) { pollinate() } else { super.invaded( movement ) } return true } }