Hello.
I'm having a small issue with a little pong clone I'm playing around with.
Basically I'm trying to figure out how I can get the paddle to start in the middle until the mouse is on the frame.
I've done similar games in Flash before, but Processing seems to read the mouse even outside the frame.
Here's the code:
Code:
void bar_top()
{
noStroke();
//stroke(255);
fill(255,0,102);
//102,204,0
//153,204,0
rectMode(CENTER);
rect(xb,yb,wb,hb);
rect(xb,yb+5, wb/5, hb);
rect(xb,yb+10, wb/10, hb);
println(xb);
if (xb >= 28 && xb <= 377)
{
xb = mouseX;
}
}
So what im trying to do is keep it in the bounds above.
xb = 200, but that only works for one frame, then its reset to 0.
Any suggestions?
Maybe there's a good pong clone I could take a look at that someone knows?
I'm going to also have the ball start off the paddle like Pong.
I was thinking about doing that with a boolean, or variable triggered on Space Bar or something like that.
Any suggestions would be fantastic.
Cheers