Multi class question
in
Programming Questions
•
11 months ago
Hello.
I am working on a simple game project and have a problem with multiple classes (static/nonstatic voids).
I want my main class to be very clean, which means only setup(), draw() and keyevent. Therefor I have a second class named voids having different voids containing rect() and image() functions. For example one for drawing a map.
So inside the main class i get:
and inside the voids class:
this way the main class complains " Cannot make a static reference to the non-static method drawMap(int[][][], int) from the type voids" and suggests to make drawMap() static.
But if i make drawMap() static the rect() function complains " Cannot make a static reference to the non-static method rect(float, float, float, float) from the type PApplet"
Do you have any suggestions on how to fix this, I know it would work to move the drawMap void to the main class, but i want it clean.
Thanks for the help // Differenze :)
I am working on a simple game project and have a problem with multiple classes (static/nonstatic voids).
I want my main class to be very clean, which means only setup(), draw() and keyevent. Therefor I have a second class named voids having different voids containing rect() and image() functions. For example one for drawing a map.
So inside the main class i get:
public void setup(){size(1024,640);//etc}public void draw(){voids.drawMap(map.main, lvl);voids.drawPlayer(posX,posY);}
and inside the voids class:
public void drawMap(int map[][][], int lvl){//code drawing the map, containing:rect(a,b,c,d);}
this way the main class complains " Cannot make a static reference to the non-static method drawMap(int[][][], int) from the type voids" and suggests to make drawMap() static.
But if i make drawMap() static the rect() function complains " Cannot make a static reference to the non-static method rect(float, float, float, float) from the type PApplet"
Do you have any suggestions on how to fix this, I know it would work to move the drawMap void to the main class, but i want it clean.
Thanks for the help // Differenze :)
1