Hello!
I’m a Design student at University of São Paulo and I’ve had some Processing classes and now I have to do a final project. I’m doing a simple game similar to Facebook’s Everwing based on Steven Universe.
It’s basically you controlling Steven with the mouse, shooting and killing enemies that come from above. But I can’t seem to possibly make the collision happen in any way.
By now, the character are all appearing and the shots as well but they don’t have any interaction!
Is there anyone that can help me? I need to deliver this by Sunday and I’m freaking out!
int x = 275;
int y = 500;
int inimigosTamanho = 50;
int inimigosX = 100;
int inimigosY = 100;
int tirox = 5;
int tiroy = 5;
int movX = 0;
int barraLateral = 250;
int tirotamanho = 20;
int[] posicaoX = {100, 180, 260, 340};
PImage[] imagens;
boolean acerto = false;
PVector [] tiros;
void setup () {
size (800, 600);
imagens = new PImage [5];
imagens [0] = loadImage ("Steven.png");
imagens [1] = loadImage ("tiro.png");
imagens [2] = loadImage ("Rubi.png");
fill (120, 0, 40);
frameRate(60);
}
void draw () {
background (0, 120, 240);
noStroke();
movX = movX +5;
int z = mouseX;
int w = mouseY;
int s = mouseX+25;
int r = mouseY - tiroy;
rect (550, 0, barraLateral, 600);
inimigos (5);
colisao ();
fill (255, 0, 0, 0);
rect (z, w, 50, 50);
fill (127);
image (imagens[0], z, w, 50, 50);
if (key == CODED) {
if (keyCode == CONTROL) {
fill (255, 0, 0, 0);
rect (s, r, tirotamanho, tirotamanho);
fill (127);
image (imagens[1], s, r, tirotamanho, tirotamanho);
tiroy = tiroy + 60;
if (r < 0) {
tiroy = 0;
}
}
}
if (movX > height) {
movX = 0;
inimigosY = 0;
}
}
void inimigos (int quant) {
int xDef = width - barraLateral;
for (int i = 0; i < quant; i++) {
image (imagens[2], (xDef/(quant ) * i) + (xDef/(quant)-inimigosTamanho)/2, inimigosY + movX, inimigosTamanho, inimigosTamanho);
}
}
void colisao () {
if (s && r ==