Unexpected errors
in
Programming Questions
•
2 years ago
Hi guys, I'm a student working on some coursework, but to actually check my code works I need to run it. I'm in the early stages of development and have come across a couple of errors, which processing hasn't provided any detail to help me solve on my own.
player player1;
void setup() {
size(800,600);
background(51);
player1 = new player(400,300);
}
void draw() {
}
class player(int x, int y){
int a = x;
int b = y;
PImage sprite = loadImage("downCenter.png");
image(sprite, a, b);
}
This is my code, and it either generates an "Unexpected token: void", "Unexpected token: {" or "unexpected token: (" error depending on how I've tried rearranging my code.
With this layout I'm getting the last of these errors, and have no idea how to solve it.
Any help would be greatly appreciated.
player player1;
void setup() {
size(800,600);
background(51);
player1 = new player(400,300);
}
void draw() {
}
class player(int x, int y){
int a = x;
int b = y;
PImage sprite = loadImage("downCenter.png");
image(sprite, a, b);
}
This is my code, and it either generates an "Unexpected token: void", "Unexpected token: {" or "unexpected token: (" error depending on how I've tried rearranging my code.
With this layout I'm getting the last of these errors, and have no idea how to solve it.
Any help would be greatly appreciated.
1