Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
m.kusk
m.kusk'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
Elementary stuff I suppose
[2 Replies]
01-Jun-2011 01:20 PM
Forum:
Programming Questions
I have this wonderful job teaching this kid math. We do it with processing and he made some code today. It doesnt work I cant figure out why.
I kno that there are better ways of doing it, but he's 11 and this way is understandable for him.
All help warmly welcome.
float fk1=random(600);
float fk1s=fk1+20;
float fk2=random(600);
float fk2s=fk2+20;
float fk3=random(600);
float fk3s=fk3+20;
float fk4=random(600);
float fk4s=fk4+20;
float fk5=random(600);
float fk5s=fk5+20;
void setup() {
size(600, 600);
}
void draw() {
rect(fk1,fk1,20,20);
println(fk1);
println(fk2);
println(fk3);
println(fk4);
println(fk5);
noLoop();
}
void mousePressed() {
println(mouseX);
println(mouseY);
if(mouseX>fk1 && mouseX<fk1s && mouseY>fk1 && mouseY<fk1s) {
rect(fk2,fk2,20,20);
}
if(mouseX>fk2 && mouseX<fk2s && mouseY>fk2 && mouseY<fk2s) {
rect(fk3,fk3,20,20);
}
if(mouseX>fk3 && mouseX<fk3s && mouseY>fk3 && mouseY<fk3s) {
rect(fk4,fk4,20,20);
}
if(mouseX>fk4 && mouseX<fk4s && mouseY>fk4 && mouseY<fk4s) {
rect(fk5,fk5,20,20);
}
}
«Prev
Next »
Moderate user : m.kusk
Forum