Processing.core in netbeans: instantiating isn't being helpful
in
Integration and Hardware
•
1 year ago
I have used Processing for several months, and made a few games. After a while I started thinking about using NetBeans with the Processing core.jar file because after a stress test it increased fps by 10. So far nothing went wrong on the technical side, but now I am running into obstacles that I have yet to familiarize with...
The main issue is that since every variable or class in processing could be globally referenced from every other class/tab, NetBeans doesn't like that happening so I have to adjust. One of the issues I have right now has to do with using an image sprite for a game. You usually load the image in the setup method in the main class (like in processing), but in NetBeans you also have to recreate the main class in another class in order for the other class to know what you are talking about, such as in "block"...
- WaveLooter WL=new WaveLooter();
WaveLooter is the main class that has the setup, draw, etc.
Now, the strange thing that confuses me is when you instantiate. Should I be doing that? When I am doing it right now, everything in the class resets, which does almost nothing productive except help me return variables that were declared outside setup. BUT, since setup is where the image is loaded, I get a nullpointerexception error when I try to do this in the block class...
- image(WL.waterPic,x,y);
Also, even if I could instantiate the main class to load the image for me to use, that would probably lag the game since many images would be loaded from the folder every frame instead of being taken from the application when it already loaded the images from the beginning.
I would like to know how to return an image that has already loaded without making a brand new class that has no image, and also how to do this with other classes, but for anything that could have changed in that object already, (ie I want to see if a ball hit a certain block but don't want to create a new block that wouldn't have the specific coordinates of the currently existing one.)
1