Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
a2aaron
a2aaron's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Unexpected Character in class problem
[3 Replies]
15-Aug-2011 04:43 PM
Forum:
Programming Questions
Ok… I just got into "Object Oriented Programing" AKA using classes and objects and I am getting an error in the class(not
surprised) and the tutorial
isn't helpin
g
I'm trying to make it so the ship moves left and right when the arrow keys are pressed (this is the start to a game type thing)
but I get "unexpected token: ("
From other examples I have seen, you need something in the "()" in the "Ship()"
Here is the class:
class Ship {
int x // x poistion of ship
Ship() { //
THIS IS WHERE THE ERROR IS
x = 255
}
void show{
fill(255);
triangle(30+x,75,58+x,10,86+x,75);
}
void keys {
if(keyPressed && key == LEFT){
x = x + 50;
}
else if(keyPressed && key == RIGHT);{
x = x - 50
}
else(){
}
}
«Prev
Next »
Moderate user : a2aaron
Forum