Help on adding Color Collision to my game

Hey, so I am somewhat new to coding, and I have began to create a game out of what I knew. The game is pretty much like the Chrome dino jump game, but simplified for now as I make the base code. So far, I have all I need to complete the game, all I need is to add more spikes and details. But then there is the collision. Because I am new, I cant seem to get my rectangle (Dino) to hit the triangles (spikes). Because the spikes are moving towards the dino, and the dino is stationary except for jumping, I need the triangles to reset position when hit. But when the game runs, the rectangle goes right past. Right now, I’m using color collision, a code that detects color and moves a shape when they come in contact. I was hoping someone here smarter than me could help me figure out why this code wont work. Ill provide more info if needed. Thanks! Here’s the code:

float xSpike = 900;
float ySpike = 100;
int exSpike=1000;
int level=0;

int ex2 = 1300;
int ex3 = 1600;
int ex4 = 1800;
int ex5 = 2100;
int ex6 = 2500;

//text level two 
int ext = 2800;

//level two triangles 
int ex7 = 3700;
int ex8 =4000;

int groundY =570;
float roof =10;
float playerWidth =50;
int playerHeight=70;
float playerSpeedY=0;
float playerSideX =0;
int ex=155;
int ey=510;
int lives=3;
boolean jumping= false;


int a=25;
int s=480;
int S=25;
int A=25;

float Y=50;
float X=50;
float x = 900;
float y = 100;
float speed = 1;
int playerX=205;
int playerY=500;


void setup () {
  size (1000, 600);
}

void draw () {
  background (255); 
  textSize (10) ;
  text ("lives=", 20, 20);
  text (lives, 55, 20) ;
  fill (#4AB412) ;
  fill (#256702);

  playerY += playerSpeedY;
  if (playerY + playerHeight > groundY) {
    playerY = groundY - playerHeight;
    playerSpeedY=0;
    jumping = false;
  } else {
    playerSpeedY ++;
  }
  strokeWeight (1);
  rect (playerX, playerY, playerWidth, playerHeight) ;
  if (get (playerX+205, playerY+500) == color (143, 203, 39))
  {
    playerX=200;
    lives=lives-1;
  }

  strokeWeight (1) ;

  //Triangle 1
  fill (143, 203, 39) ;
  triangle (exSpike, 570, exSpike+20, 570, exSpike, 540);
  exSpike = exSpike -3;

  // triangle 2
  triangle (ex2, 570, ex2+20, 570, ex2, 520);
  ex2 = ex2 -3;

  // triangle 3
  triangle (ex3, 570, ex3+20, 570, ex3, 515);
  ex3 = ex3 -3;

  // triangle 4
  triangle (ex4, 570, ex4+20, 570, ex4, 500);
  ex4 = ex4 -3;

  // triangle 5
  triangle (ex5, 570, ex5+20, 570, ex5, 520);
  ex5 = ex5 -3;

  // triangle 6
  triangle (ex6, 570, ex6+20, 570, ex6, 510);
  ex6 = ex6 -3;

  //LEVEL TWO 

  textSize (40);
  fill (0);
  text ("Level Two", ext+300, 400);
  ext=ext -3;

  // triangle 7
  fill (143, 203, 39) ;
  triangle (ex7+100, 570, ex7+120, 570, ex7+100, 500);
  ex7 = ex7 -4;

  // triangle 8
  fill (143, 203, 39) ;
  triangle (ex8+100, 570, ex8+120, 570, ex8+100, 500);
  ex8 = ex8 -4;

  line (0, groundY, width, groundY);
}

void keyPressed () {
  if (!jumping) {
    playerSpeedY = -20;
    jumping=true;
  }
}

http://www.jeffreythompson.org/collision-detection/poly-rect.php

CrHallberg.com/CollisionDetection/Website/poly-rect.html