Display decor using tables

Hello,

I inform you I'm not a programmer and don't know the word and the best practices.

My project is to create a donkey kong video game using Processing, the old version of DK with Mario and ladders, etc..

In order to display the decor and then use those data to interact with Mario, I would like to add those data in a table.

I don't know if I'm clear but I need help for this. Thank you;


int
ecran_w = 1200, 
ecran_h = 675, 
mario_pos_x = 50, 
mario_pos_y = 570;

boolean
engagementSaut = false, 
keyup = false, 
keyright = false, 
keyleft = false, 
keydown = false, 
keyspace = false;

ArrayList 
DecorList = new ArrayList();

PImage
photoVictoire, 
mario_r, 
mario_l, 
DonkeyKong, 
Peach;

Decor decor = new Decor(0, 600, 1200, 25, 255, 165, 0);


void setup() {
  frameRate(150);
  size(ecran_w, ecran_h);
  background(0);

  photoVictoire = loadImage("DK 64 Victory.png");
  mario_r = loadImage("Mario_R.png");
  mario_l = loadImage("Mario_L.png");
  DonkeyKong = loadImage("Donkey Kong.png");
  Peach = loadImage("Peach.png");
}

void draw() {
  background(0);

  image(DonkeyKong, 50, 144);
  image(Peach, 500, 55);

  decor.init();
  decor.display();
}


class Decor {
  int x, y, largeur, hauteur, couleurRed, couleurGreen, couleurBlue;

  Decor(int xpos, int ypos, int l, int h, int cR, int cG, int cB) {
    x = xpos;
    y = ypos;
    largeur = l;
    hauteur = h;
    couleurRed = cR;
    couleurGreen = cG;
    couleurBlue = cB;
  }

  void display() {
    for (int i = 0; i < DecorList.size (); i++) {
      Decor xpos = (Decor) DecorList.get(i); 
      Decor ypos = (Decor) DecorList.get(i);
      Decor l = (Decor) DecorList.get(i);
      Decor h = (Decor) DecorList.get(i);
      Decor cR = (Decor) DecorList.get(i);
      Decor cG = (Decor) DecorList.get(i);
      Decor cB = (Decor) DecorList.get(i);

      fill(couleurRed, couleurGreen, couleurBlue);
      rect(x, y, largeur, hauteur);
    }
  }

  void init() {  
    if (DecorList.size()<8) {
      DecorList.add (new Decor(0, 600, 1200, 25, 255, 165, 0));
      DecorList.add (new Decor(0, 500, 1200, 25, 255, 165, 0));
      DecorList.add (new Decor(0, 400, 200, 25, 255, 165, 0));
      DecorList.add (new Decor(300, 400, 600, 25, 255, 165, 0));
      DecorList.add (new Decor(0, 300, 500, 25, 255, 165, 0));
      DecorList.add (new Decor(700, 300, 500, 25, 255, 165, 0));
      DecorList.add (new Decor(0, 200, 1200, 25, 255, 165, 0));
      DecorList.add (new Decor(500, 100, 200, 25, 255, 165, 0));
    }
  }
}

This is what I have : DK (1)

This is what it should look like (the orange ones) DK (2)

Answers

Sign In or Register to comment.