I'm working on a Bullet Hell style game, and I have added a "Mana" mechanic, in which the user is able to use stronger attacks, at the cost of their mana being reduced. Mana regenerates over time, and I attempted to implement a Mana meter, where an Actor Rocket checks if it's mana is a certain number, and if it is, spawns an actor ManaSpec(number). This all works fine, until i try to remove the ManaSpec, where it says that the actor has not been initialised. The code usd is the one below. Keep in mind, the Mana variable and this code is exclusive to the Rocket actor, and the ManaSpec has no code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | if (mana >= 1000 ) { getWorld().addObject( new ManaSpec1( this ), 583 , 12 ); } //code for spawning a manaSpec if (mana < 1000 ) { Actor ManaSpec1; World world; world = getWorld(); world.removeObject(ManaSpec1); } //code for removing |