Toribash
Original Post
Is anyone good at the Processing coding language?
I desperately need help from someone that's good at coding in Processing.
I need to create a clone of the game Breakout, I'll pay if I have to.
I run some tuts for Processing with highschool kids who come visit my uni so I'm familiar with it.

I'm guessing this is an assignment/homework though so my first suggestion is that you go read over your course material and do your tuts and exercises.

If you've done that and still need help then maybe give a bit more information? "breakout clone" tells us pretty much nothing.
Breakout is the name of a popular game.

Here are screenshots of the assignment, I've already completed part 1, just need to do parts 2 and 3:



So what's stopping you from doing parts 2 and 3?

No one here is going to do your homework for you, but many people will happily discuss your work with you.
Edit: Oh nvm, ignore the first thing I wrote.
(And as both people, who posted before me already said: Nobody is gonna do your homework)



That's a pretty easy task, that even beginners can do easily. So you should be able to do that, tbh.
Last edited by Gambi; May 29, 2016 at 11:40 PM.
Okay guys I'm not asking anyone to do my homework but I really am stuck.

I got my part 1 working as shown with the code below.

But part 2 is a problem for me. I cannot get the ball to launch; it is stuck to the paddle. Also, the paddle moves off the right side of the screen when I move my mouse that way, but it's fine when I move the mouse out the left side of the screen, not sure why.

I did not start part 3 yet and would appreciate any and all help in completing this project. Will pay if needed.

Part 1 code:

int m = 5;
int h = 100/m;
int n = 10;
int w = 400/n;
int [][] bricks = new int [m][n];
color[] colors = {color(255), color(128)};
void setup () {
size(400, 400);
}
void draw() {
background(128);
int y = 100;
for (int i = 0; i < bricks.length; i++) {
int x = 0;
for (int j = 0; j < bricks[i].length; j++) {
fill (colors[bricks[i][j]]);
rect(x, y, w, h);
x = x + w;
}
y = y + h;
}
}
void mousePressed() {
int y = 100;
for (int i = 0; i < bricks.length; i++) {
int x = 0;
stroke(128);
for (int j = 0; j < bricks[i].length; j++) {
if (mouseX < x + w && mouseY < y + h && mouseX > x && mouseY > y) {
bricks[i][j] = (bricks[i][j] + 1)%2;
}
x = x + w;
}
y = y + h;
}
}


Part 2 code:

int x = mouseX+50;
int y = 335;
int speedX = 3;
int speedY = 4;

void setup() {
size(400, 400);
}

void draw() {
background(0);
fill(0, 255, 0);
rect(mouseX, 350, 100, 30);
drawBall();
}

void drawBall() {
fill(255);
ellipse(mouseX+50, 335, 25, 25);
}

void moveBall() {
x = x + speedX;
y = y + speedY;
}

void bounceBall() {
if (x > 375 || x < 25) {
speedX = -1*speedX;
}

if (y > 375 || y < 25) {
speedY = -1*speedY;
}
}

void mousePressed() {
moveBall();
}
Well for the ball launch, isn't it because you are calling "ellipse(mouseX+50, 335, 25, 25)"? Shouldn't that be "ellipse(x, y, 25, 25);"? You are updating x and y but I don't see them where I would expect.

For the paddle moving off the screen, I suspect it's because you need to do bound checking. Your paddle is 100 units wide, so you need to stop it moving when it's 100 units from the right edge of the screen.
Consider doing something like
. code:

int windowWidth = 400;
int windowHeight = 400;
int paddleWidth = 100;
int paddleX = 0;

void setup() {
size(windowWidth,windowHeight);
}


void draw() {
...
paddleX = mouseX;
if(mouseX > windowWidth-paddleWidth) paddleX = windowWidth-paddleWidth;
rect(mouseX, 350, 100, 30);
...
}
jesus mate try stackoverflow or something thats a lot of prerequisite info in order to help you out
i created the ??? emoji
like a lighter bitch we ignit
Originally Posted by GnilRettemHC View Post
Well for the ball launch, isn't it because you are calling "ellipse(mouseX+50, 335, 25, 25)"? Shouldn't that be "ellipse(x, y, 25, 25);"? You are updating x and y but I don't see them where I would expect.

For the paddle moving off the screen, I suspect it's because you need to do bound checking. Your paddle is 100 units wide, so you need to stop it moving when it's 100 units from the right edge of the screen.
Consider doing something like
. code:

int windowWidth = 400;
int windowHeight = 400;
int paddleWidth = 100;
int paddleX = 0;

void setup() {
size(windowWidth,windowHeight);
}


void draw() {
...
paddleX = mouseX;
if(mouseX > windowWidth-paddleWidth) paddleX = windowWidth-paddleWidth;
rect(mouseX, 350, 100, 30);
...
}

Whoever is teaching you how to code is teaching you completely arbitrary shit.
Originally Posted by GnilRettemHC View Post
Well for the ball launch, isn't it because you are calling "ellipse(mouseX+50, 335, 25, 25)"? Shouldn't that be "ellipse(x, y, 25, 25);"? You are updating x and y but I don't see them where I would expect.

For the paddle moving off the screen, I suspect it's because you need to do bound checking. Your paddle is 100 units wide, so you need to stop it moving when it's 100 units from the right edge of the screen.
Consider doing something like
. code:

int windowWidth = 400;
int windowHeight = 400;
int paddleWidth = 100;
int paddleX = 0;

void setup() {
size(windowWidth,windowHeight);
}


void draw() {
...
paddleX = mouseX;
if(mouseX > windowWidth-paddleWidth) paddleX = windowWidth-paddleWidth;
rect(mouseX, 350, 100, 30);
...
}

Thanks for the reply bro, but I'm getting a bunch of errors when trying to run the code. I'd appreciate changes to my original code to actually make it work.

Originally Posted by cocacobra View Post
jesus mate try stackoverflow or something thats a lot of prerequisite info in order to help you out

I just signed up, let's see how that goes. Thanks!

Originally Posted by BaraYaoi View Post
Whoever is teaching you how to code is teaching you completely arbitrary shit.

Would you be able to help out?