Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
lucas.ward
lucas.ward'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
What is wrong with this Car class?
[3 Replies]
01-Feb-2013 05:36 AM
Forum:
Programming Questions
I was trying the OOP tutorial and just copying the tutorial code exactly i still had errors, is there anything wrong with the code here?:
class Car {
color c;
float xpos;
float ypos;
float xspeed;
void setup() {
Car() {
c = color(255);
xpos = width/2;
ypos = height/2;
xspeed = 1;
}
}
void draw() {
background(0);
display();
drive();
}
void display() {
rectMode(CENTER);
fill(c);
rect(xpos,ypos,20,10);
}
void drive() {
xpos = xpos + xspeed;
if (xpos > width) {
xpos = 0;
}
}
}
«Prev
Next »
Moderate user : lucas.ward
Forum