Respawning Spike after it dies [Need Help]

Hey Everyone,

So basically i want to make my spike respawn at the same position it starts at after it hits the ground. I know how i can do it with 1 but i have an array list and i add multiple spikes using this arraylist at different positions. does anyone know how i could do this ?

here is how i add them into the game just so you know

Controller.spikes.add(new Spike(tileMap, 5,1));
Controller.spikes.add(new Spike(tileMap, 10,5));

thanks

  • GlennBrann

Just keep rendering them or make a new instance of the spike? I don’t entirely understand why this is an issue…

Ok instead of worrying about the array handle it all within the object, this is done by also setting a start x and start y. when the spike is destroyed call a destroy function inside the spike object that resets the current x and y to the start x and start y.