Unexpected token: void
in
Programming Questions
•
2 years ago
first off GODDAMN THIS ERROR IT IS SO NONSPECIFIC!!!
secondly here is my code:
- Controller tester = new Controller(true, 1);
- void setup(){
- size(500,500);
- background(0);
- tester.addToSystem
- }
- void draw(){
- tester.addForces;
- tester.updateSystem;
- }
- public class Controller{
- float gravity;
- boolean gravityOn;
- Controller(boolean gravityTrue,float gravityValue){
- gravity = gravityValue;
- gravityOn = gravityTrue;
- vPoint tester;
- }
- void addToSystem(){
- tester = new vPoint(100,100);
- }
- void addForces(){
- if(gravityOn = true)
- {
- vPoint.y+=gravity;
- }
- }
- void updateSystem(){
- tester.update();
- tester.render();
- }
- }
- public class vPoint{
- float x;
- float y;
- float oldx;
- float oldy;
- vPoint(float fx, float fy){ // fx is first x and ditto for y
- x = fx;
- y = fy;
- x = oldx = x;
- y = oldy = y;
- }
- void update(){
- float tempx = x;
- float tempy = y;
- x+= x - oldx;
- y+= y - oldy;
- oldx = tempx;
- oldy = tempy;
- }
- void render(){
- stroke(255);
- line(x,y,oldx,oldy);
- }
- }
It is a verlet physics engine and i know the vPoint class is fine because i tested it. I just messed up the Controller class I think can someone help me out cause this error is killing me. I know there may be some unrelated errors in my code but i can't even check them till i fix this darn error. BTW no arrays yet because it's faster to test on on point for now.
thanks!
1