Object Collision Question
in
Programming Questions
•
4 months ago
Hello, first question here!
I need to have the slime spots dropped by pressing 'F' to cause the ants to die. I'm new to coding and am struggling with this final aspect of my program. I cannot get my collision code to work. Any help or advice would help. I tried to include only the relevant code
------------------------------------------------------------------------
int gameState = 0;
float antx = 300.0;
boolean squareCollided = false;
class Slime {
}
Slime[] slimetrail = new Slime[5];
void setup() {
slime.filter(POSTERIZE,10);
void draw() { // this is run repeatedly.
image(grass,200,200,height,width);
pushMatrix();
else {
imageMode(CENTER);
antx += sin(anty * .08 ) + (antspeedX * antdirectionX);
frameRate(60);
frameRate(60);
pushMatrix();
angle += rotateSpeed * (right - left);
for (int i = 0; i < 5; i++) {
}
void keyReleased() {
if (key == 'f'){
if (rectCollide(antx, anty, antx + antradius * 2, anty + antradius * 2, slimetrail[i].x slimetrail[i].y)) {
boolean rectCollide(float left, float top, float right, float bottom,
}
1