We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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 :
This is what it should look like (the orange ones)
Answers
You'll get a better response if you format your code:
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
If i'm getting you right and you want to have such information as position and size of each platform in a table-like format, you can certainly use Processing's Table class. It is convinient, because you can simply load a csv file into it and if you want to change something, just change that file!
Hi guys, Bilmor sorry for this. Next time it will be better.
Ater, I tried the table class as you recommanded me. I succeeded to display the orange lines, thank you a lot. Now I will try to interact with Mario, I'll inform you.
Thank you again guys ;)
"Next time it will be better."
No need to wait for "next time", just edit your message (the gear icon) and fix the formatting.
Hello everybody, Here you can find the project we released for the teacher:
https://drive.google.com/open?id=0B_83DR6d6W2QM21tQlpINGJNZ2M&authuser=0
Thank you for your help.
hey spacetcha, do you still have the code, i'm programing a game like yours and not succeeding, it would be of great hel if you posted it thanks!!
You're posting in a thread that's almost two years old, asking someone who we haven't seen again in almost two years.
You are unlikely to get any answers here - stick to your own discussion.
Hello gbel, here you can find the last version of my game : https://drive.google.com/open?id=0B_83DR6d6W2QdlZxcXIxb09IODg
Have fun ;)
Thank you!!