Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
algol68ok
algol68ok's Profile
1
Posts
2
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
how to let a line horizontally move on the editor window ?
[2 Replies]
04-Feb-2012 05:47 AM
Forum:
Programming Questions
class line {
color a;
float xpos;
float ypos;
float x2pos;
float y2pos;
float xspeed;
righteye(color tempA,float tempXpos,float tempYpos,float tempXspeed) {
a = tempA;
xpos = tempXpos;
ypos = tempYpos;
x2pos = xpos - 10;
y2pos =ypos + 10;
xspeed =tempXspeed;
}
void display() {
stroke(0);
fill(a);
line(xpos,ypos,x2pos,y2pos);
}
void drive() {
xpos = xpos + xspeed;
x2pos = x2pos + xspeed;
if (xpos>width){
xpos =10;
x2pos = 0;
}
}
}
.....
.....
line myline;
void setup() {
size (200,200);
myline = new line(color(255,0,0),10,100,1);
}
void draw() {
background(255);
myline.display();
myline.drive();
}
i'm a beginner,not good at computer. i want to let a line horizontal move on the editor window , i tried to use the "class" to do it ,but it doesn't work....
i'm stupid, haven't any conception about it....
what's the right way?
«Prev
Next »
Moderate user : algol68ok
Forum