I need help converting my code to use PVectors instead of int, float and etc.!

PImage [] Lambos = new PImage [5];
PImage checkered;
PImage background;
int [] horsePos = new int [5];
int [] results = new int [5];
int [] carY = new int [5];
int [] odds = new int [5];

int currPlace = 0;
float y;
boolean wagerIsAdded = false;

int state = 0;
float playerWager = 0;
float player2Wager = 0;
int xSlider = 235;
int xSlider2 = 800;
int min;
float max;
float max2;
int p1Choice;
int p2Choice;
int Winner = -1;

float playerBank = 1000;
float player2Bank = 1000;

void setup() {
  size(1200, 800);
  min = 10;

  Lambos[0] = loadImage("red.png");
  Lambos[1] = loadImage("orange.png");
  Lambos[2] = loadImage("blue.png");
  Lambos[3] = loadImage("green.png");
  Lambos[4] = loadImage("yellow.png");

  //Image location on Y coordinate
  carY[0] = 302;
  carY[1] = 390;
  carY[2] = 490;
  carY[3] = 585;
  carY[4] = 680;

  checkered = loadImage("tile.jpg");
  background = loadImage("back.png");
}


void draw() {

  background(0);
  max = playerBank;
  max2 = player2Bank;

  if (state == 0) {

    for (int i=0; i < 5; i++) {
      Lambos[i].resize(90, 30);
    }

    stroke(255);
    strokeWeight(10);
    fill(255);
    line (235, 290, 435, 290);
    rect(xSlider, 275, 10, 30);
    line (800, 290, 1000, 290);
    rect(xSlider2, 275, 10, 30);
    stroke(255);
    strokeWeight(10);
    line(600, 100, 600, 716);

    playerWager = map(xSlider, 235, 435, min, max);
    player2Wager = map(xSlider2, 800, 1000, min, max2);

    if (dist(mouseX, mouseY, xSlider, 275) < 70 && mousePressed) {
      xSlider = mouseX;
    }

    if (dist(mouseX, mouseY, xSlider2, 275) < 70 && mousePressed) {
      xSlider2 = mouseX;
    }

    if (xSlider < 235) {
      xSlider = 235;
    } else if (xSlider > 435) {
      xSlider = 435;
    }
    if (xSlider2 < 800) {
      xSlider2 = 800;
    } else if (xSlider2 > 1000) {
      xSlider2 = 1000;
    }

    text("Bank:" + " " + (int)playerBank, 270, 250);
    text("Bank:" + " " + (int)player2Bank, 830, 250);

    textSize(17);
    text("Wager:" + " " + (int)playerWager, 280, 200);
    textSize(17);
    text("Wager:" + " " + (int)player2Wager, 840, 200);
    textSize(30);
    text("Race Game Assignment", 460, 50);
    textSize(15);
    text("By: Nathaniel K.", 560, 75);
    textSize(30);
    text("PLAYER 1", 260, 130);
    text("PLAYER 2", 830, 130);

    text("Car Bet On:" + " " + p1Choice, 230, 550);
    text("Car Bet On:" + " " + p2Choice, 800, 550);

    noFill();
    rect(50, 100, 1100, 675);

    strokeWeight(5);
    textSize(20);
    text("START", 568, 752);
    noFill();
    rect(550, 720, 100, 50);

    for (int i= 0; i <5; i ++) {
      image(Lambos[i], 70 + (105 * i), 400);

      if (mouseX > 70 + (105 * i) && mouseX < 70 + (105 * i) + 100 && mouseY < 430 && mouseY > 400 && mousePressed) {
        p1Choice = i + 1;
        rect(70 + (105 * i), 400, 92, 31);
      }
    }

    for (int i= 0; i <5; i ++) {
      image(Lambos[i], 620 + (105 * i), 400);

      if (mouseX > 620 + (105 * i) && mouseX < 620 + (105 * i) + 100 && mouseY < 430 && mouseY > 400 && mousePressed) {
        p2Choice = i + 1;
        rect(620 + (105 * i), 400, 92, 31);
      }
    }

    if (dist(mouseX, mouseY, 70, 400) < 50) {
      rect(65, 395, 95, 35);
    }

    if (dist(mouseX, mouseY, 600, 740) < 30 && mousePressed) {
      state = 1;
    }
  } else if (state == 1) {
    background.resize(width, height);
    background(background);

    for (int i = 0; i < 5; i ++) {
      odds[i] = (int)random(0, 4);
    }

    for (int i=0; i< 5; i++) {
      Lambos[i].resize(110, 40);
    }

    textSize(30);
    text("1", 950, 330);
    text("2", 950, 423);
    text("3", 950, 520);
    text("4", 950, 621);
    text("5", 950, 712);

    finishline();

    for (int i=0; i < 5; i++) {
      image(Lambos[i], horsePos[i], carY[i]);
    }

    for (int i = 0; i < 5; i ++) {
      horsePos[i] += noise(y) * 8;
      y += 1.8;
    }


    for (int i = 0; i < 5; i ++) {
      if (horsePos[i] > 987 && results[i] == 0) {
        results[i] = currPlace;
        currPlace ++;

        if (Winner == -1) {
          Winner = i + 1; // the winner
        }

        if (currPlace > 5) {
          if (p1Choice == Winner) {
            playerBank = playerBank + playerWager * odds[p1Choice];
          } else {
            playerBank = playerBank - playerWager * odds[p1Choice];
          }

          if (p2Choice == Winner) {
            player2Bank = player2Bank + player2Wager * odds[p2Choice];
          } else {
            player2Bank = player2Bank - player2Wager * odds[p2Choice];
          }
          state = 2;
        }
      }
    }
  } else if (state == 2) {
    background(background);

    finishline();

    for (int i=0; i< 5; i++) {
      image(Lambos[i], horsePos[i], carY[i]);
    }

    fill(0);
    rect(50, 100, 870, 675);

    textSize(20);
    strokeWeight(5);
    fill(255);
    text("START", 220, 747);
    line(500, 100, 500, 770);
    noFill();
    rect(200, 720, 100, 40);

    textSize(30);
    text("RESULTS", 240, 130);
    text("POINTS", 680, 130);

    textSize(20);
    for (int i=0; i < 5; i++) 
      text("Car "+str(i+1)+": "+results[i], 100, 180+i*60);

    text("Player 1:" + " " + (int)playerWager + " " + "on" + " " + "Horse #" + p1Choice, 600, 200);
    text("Current Points:" + " " + (int)playerBank, 600, 250);
    text("Odds:" + " " + odds[p1Choice], 600, 300);

    text("Player 2:" + " " + (int)player2Wager + " " + "on" + " " + "Horse #" + p2Choice, 600, 400);
    text("Current Points:" + " " + (int)player2Bank, 600, 450);
    text("Odds:" + " " + odds[p2Choice], 600, 500);

    if (dist(mouseX, mouseY, 230, 730) < 50 && mousePressed) {
      state = 0;
      for (int i = 0; i < 5; i ++) {
        horsePos[i] = 0;
        results[i] = 0;
      }
      currPlace = 0;
      Winner = -1;
      wagerIsAdded = false;
    }

    textSize(30);
    text("1", 950, 330);
    text("2", 950, 423);
    text("3", 950, 520);
    text("4", 950, 621);
    text("5", 950, 712);

    if (playerBank <= 0 || player2Bank <= 0) {
      state = 3;
    }
  } else if (state == 3) {

    background(0, 255, 0);

    if (playerBank <= 0) {
      textSize(40);
      text("PLAYER 2 WINS!", 470, 300);
      text("Bank:" + " " + (int)player2Bank, 520, 400);
    }

    if (player2Bank <= 0) {
      textSize(40);
      text("PLAYER 1 WINS!", 470, 300);
      text("Bank:" + " " + (int)playerBank, 520, 400);
    }
  }
}


void finishline() {
  checkered.resize(540, 505);
  image(checkered, 1100, 260);
}

Answers

This discussion has been closed.