We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi! I'm a Multimedia Designer student and I'm having trouble making my game work. In the game, you're a cooker who makes hamburguers. I have a grid where my ingredients will be, some "recipes" saying what and in wich order to put them, a plate where the ingredients will appear, a time counter, and points.
Now my questions: should I make a class for the recipes, the hamburguers, and the ingredientes, with arrays on them, then make the arrays compare to know if the hamburguer is well done?
I have a class Recipe (5 ingredients) :
class Recipe{
int ingredientes [] = new int [5];
Receta (int a, int b, int c, int d, int e){
ingredientes [0]= a;
ingredientes [1]= b;
ingredientes [2]= c;
ingredientes [3]= d;
ingredientes [4]= e;
;
}
in order to know if the hamburguer has the same ingredients like in the recipe (i should make them random later) do I have to make an hamburguer class with the same array of ingredients?
then, how can i make to put those numbers in my grid and know than when I click them, they would fit to the ingredients and make them appear over the plate?
sorry guys i'm so new and desseperate ahaha :(
Answers
Just like anything with programming, there are a million different ways to do this. You should choose whichever way makes the most sense to you, not the way that makes the most sense to somebody else.
You'll probably get a bunch of answers saying "you should do it XYZ" but really all it comes down to is how it fits in your head.
You've described a couple different approaches already. What happened when you tried each?
Receta (int a, int b, int c, int d, int e) {
What do those passed parameters represent? Quantity or a code for the ingredients themselves?
Anyways, if you're not gonna deal w/ more than 1 hamburger at a time, there's no real need
to create a class just for that! Even though it's nice for encapsulation!
they are a code for the ingredients.
now I have that Recipe class and an hamburguer class that goes like this:
class hamburguer {
int ingredientes [] = new int [5]; int counter;
Hamburguer () {
}
// to asign ingredients from my grid with each click:
void asignarIngrediente( int num ) {
}
// compare ingredients between the recipe and hamburguer INCOMPLETE
void comparar() {
}
any help for that?
i dont know if those zeros are well in those last arrays