We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm currently making a small game and I was wondering if anyone knows how to make it so when I change an interger it apply changes to a class then reloads the class as if the programme was just launched. I can make it change the detials of the class but these details don't take effect as the class is only ran once, when I start the programme.
Answers
How often does the reload you want occur?
You could just use new but this is inelegant and slow
Can't you just add a
reset()
function to the class?Here is probably the easiest way. Give your class a type variable that determines the details of the class's implementation.
There are other ways with inheritance, but that might be more complex than you need. Without seeing some sample code from you it is hard to tell.
This class runs when I boot up the programme. I have have a public boolean called night and when it is switched from true to false the variables on lines 43 and 65 are changed. Since this only loads at the start of the programme the variables don't actually take effect. I need the programme to go through all this code again for these changes to take effect.
Code below:
WHY!??! NOOOOOO! NOOOOOO!!!! NOOOO. NOO. NOOO.
DON'T. DO. THAT.
CHANGE THIS FIRST. You do NOT want to be reloading your images EVERY SINGLE FRAME. Just load them ONCE. Do this inside setup()!
Oh sorry. I done what you said, thank you. What do I do next?