How to make some type of pong game?

edited October 2017 in Using Processing

I'm having a hitbox problem with the rectangle and can't get it to start back at x, instead it goes straight through the rectangle

int b = mouseY;
int c = 50;
int d = 50;

void setup() {
  size(500, 500);
  noStroke();
  smooth();
  b = mouseY;
}

void draw() {
  background(200);
  fill(1, 1, 1);
  textSize(20);
  text("score", 230, 50);
  fill(255, 0, 0);
  ellipse (x, y, 25, 25);
  x = x +3;

  fill(200, 200, 0);
  rect(a, mouseY, c, d);

  if (x > width) {
    x = 0;
    y = random(500);
  } else if (
    x = 0;
    y = random(500);
  }
}

Answers

This discussion has been closed.