Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
randomusername555
randomusername555'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
New to processing, question
[5 Replies]
02-Nov-2011 10:17 AM
Forum:
Programming Questions
Hi, how do I make it so that the blue ball will drop when the line hits it 5 times?
int tX=0; //tank
int tof=40; //tank
int barrel=40; //tank
int endOflaser=0;
int ballY = 0;
int count = 0;
boolean click = false;
void setup() {
size(640, 480);
}
void draw() {
strokeWeight(5);
background(255);
fill(#1B6715);
rect(tX,440, 80,40);
fill(#1B6715);
ellipse(tof, 460, 40,40);
fill(255,0,0);
line(barrel,440, barrel, 425);
shoot();
ball();
}
void keyPressed()
{
if(key=='d'){
tX += 5;
tof += 5;
barrel +=5;
}
else if(key == 'a'){
tX -= 5;
tof -= 5;
barrel -= 5;
}
}
void mouseClicked(){
click = true;
}
void shoot(){
if(click){
line(barrel, 415, barrel, endOflaser);
}
click = false;
if(endOflaser == ballY)
count++;
}
void ball(){
fill(0,0,255);
ellipse(300,ballY, 100,100);
if(count == 5)
ballY += 50;
}
«Prev
Next »
Moderate user : randomusername555
Forum