F
frekkanzer2
Guest
Before starting, forgive me for my bad English!
Hello everyone, i'm a newbie and, for the first time, I'm writing my first game in gml.
I have a "little" problem with the game, i'll show you only the objects that may interest you about this problem:
OBJ_SET (placed at the start of the game) - CREATE EVENT
globalvar situazione;
global.day = 0;
global.playermalato = 0;
global.playerdead = 0;
randomize();
OBJ_PLAY (placed in the first room of the game) - LEFT MOUSE BUTTON PRESSED
situazione[global.day]=floor(random_range(0,9));
global.playermalato = floor(random_range(0,3));
global.playerdead = floor(random_range(0,3));
room_goto_next();
OBJ_FOGLIO1 (placed in the second room of the game) - LEFT MOUSE BUTTON PRESSED
switch(situazione[global.day]){
case 0: global.cibo += 20;
global.acqua += 20;
global.medikit = 1;
global.fucile = 1;
global.munizioni += 5;
global.valigia = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 1: global.cibo += 15;
global.acqua += 15;
global.medikit = 1;
global.valigia = 1;
global.mappa = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 2: global.cibo += 15;
global.acqua += 15;
global.medikit = 1;
global.valigia = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 3: global.cibo += 15;
global.acqua += 15;
global.mappa = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 4: global.cibo += 15;
global.acqua += 15;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 5: global.cibo += 13;
global.acqua += 13;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 6: global.cibo += 10;
global.acqua += 10;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 7: global.cibo += 5;
global.acqua += 5;
global.valigia = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 8: switch (global.playermalato){
case 0: Fabio.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 1: Tatiana.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 2: Lucas.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 3: Laura.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
}
case 9: switch (global.playerdead){
case 0: Fabio.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 1: Tatiana.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 2: Lucas.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 3: Laura.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
}
}
OBJ_FOGLIO_GIORNO1 - CREATE EVENT
switch(situazione[global.day]){
case 0: sprite_index = spr_g1s0;
case 1: sprite_index = spr_g1s1;
case 2: sprite_index = spr_g1s2;
case 3: sprite_index = spr_g1s3;
case 4: sprite_index = spr_g1s4;
case 5: sprite_index = spr_g1s5;
case 6: sprite_index = spr_g1s6;
case 7: sprite_index = spr_g1s7;
case 8: switch (global.playermalato){
case 0: sprite_index = spr_g1s8_1;
case 1: sprite_index = spr_g1s8_2;
case 2: sprite_index = spr_g1s8_3;
case 3: sprite_index = spr_g1s8_4;
}
case 9: switch (global.playerdead){
case 0: sprite_index = spr_g1s9_1;
case 1: sprite_index = spr_g1s9_2;
case 2: sprite_index = spr_g1s9_3;
case 3: sprite_index = spr_g1s9_4;
}
}
OBJ_CONTROLLORE (placed in the second room of the game) - DRAW EVENT
x=70;
y=120;
draw_set_font(Rudiment_font);
draw_set_colour(c_black);
//+30px in y
//Fabio
if (Fabio.stanco == 1){
draw_text(x,y,'Fabio è stanco');
} else if (Fabio.pazzo == 1){
draw_text(x,y,'Fabio è fuori di sè');
} else if (Fabio.malato == 1){
draw_text(x,y,'Fabio è malato');
} else if (Fabio.morte == 1){
draw_text(x,y,"Fabio è deceduto");
} else {
draw_text(x,y,'Fabio sta bene');
}
//Tatiana
if (Tatiana.stanco == 1){
draw_text(x-5,y+40,'Tatiana è stanca');
} else if (Tatiana.pazzo == 1){
draw_text(x-5,y+40,'Tatiana è fuori di sè');
} else if (Tatiana.malato == 1){
draw_text(x-5,y+40,'Tatiana è malata');
} else if (Tatiana.morte == 1){
draw_text(x-5,y+40,"Tatiana è deceduta");
} else {
draw_text(x-5,y+40,'Tatiana sta bene');
}
//Lucas
if (Lucas.stanco == 1){
draw_text(x,y+80,'Lucas è stanco');
} else if (Lucas.pazzo == 1){
draw_text(x,y+80,'Lucas è fuori di sè');
} else if (Lucas.malato == 1){
draw_text(x,y+80,'Lucas è deceduto');
} else if (Lucas.morte == 1){
draw_text(x,y+80,"Lucas non c'è più");
} else {
draw_text(x,y+80,'Lucas sta bene');
}
//Laura
if (Laura.stanco == 1){
draw_text(x,y+120,'Laura è stanca');
} else if (Laura.pazzo == 1){
draw_text(x,y+120,'Laura è fuori di sè');
} else if (Laura.malato == 1){
draw_text(x,y+120,'Laura è deceduta');
} else if (Laura.morte == 1){
draw_text(x,y+120,"Laura non c'è più");
} else {
draw_text(x,y+120,'Laura sta bene');
}
//Controlli oggetti
draw_text(x,y+160,'Cibo: '+string(global.cibo));
draw_text(x,y+200,'Acqua: '+string(global.acqua));
if (global.medikit==1){
draw_text(x,y+240,'Abbiamo un medikit');
} else {
draw_text(x,y+240,'Non abbiamo un medikit');
}
if (global.fucile==1){
draw_text(x,y+280,'Abbiamo un fucile');
} else {
draw_text(x,y+280,'Non abbiamo un fucile');
}
draw_text(x,y+320,'Munizioni: '+string(global.munizioni));
if (global.valigia==1){
draw_text(x,y+360,'Abbiamo una valigia');
} else {
draw_text(x,y+360,'Non abbiamo una valigia');
}
if (global.mappa==1){
draw_text(x,y+400,'Abbiamo una mappa');
} else {
draw_text(x,y+400,'Non abbiamo una mappa');
}
Through "OBJ_CONTROLLORE" I can monitor the final results, but there is a problem: it is as if several cases were calculated at the same time! Why this problem? What did I do wrong?
Please, I'm going crazy by three hours on this program and I don't understand what's wrong..
Pls help me <3
Hello everyone, i'm a newbie and, for the first time, I'm writing my first game in gml.
I have a "little" problem with the game, i'll show you only the objects that may interest you about this problem:
OBJ_SET (placed at the start of the game) - CREATE EVENT
globalvar situazione;
global.day = 0;
global.playermalato = 0;
global.playerdead = 0;
randomize();
OBJ_PLAY (placed in the first room of the game) - LEFT MOUSE BUTTON PRESSED
situazione[global.day]=floor(random_range(0,9));
global.playermalato = floor(random_range(0,3));
global.playerdead = floor(random_range(0,3));
room_goto_next();
OBJ_FOGLIO1 (placed in the second room of the game) - LEFT MOUSE BUTTON PRESSED
switch(situazione[global.day]){
case 0: global.cibo += 20;
global.acqua += 20;
global.medikit = 1;
global.fucile = 1;
global.munizioni += 5;
global.valigia = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 1: global.cibo += 15;
global.acqua += 15;
global.medikit = 1;
global.valigia = 1;
global.mappa = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 2: global.cibo += 15;
global.acqua += 15;
global.medikit = 1;
global.valigia = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 3: global.cibo += 15;
global.acqua += 15;
global.mappa = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 4: global.cibo += 15;
global.acqua += 15;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 5: global.cibo += 13;
global.acqua += 13;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 6: global.cibo += 10;
global.acqua += 10;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 7: global.cibo += 5;
global.acqua += 5;
global.valigia = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 8: switch (global.playermalato){
case 0: Fabio.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 1: Tatiana.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 2: Lucas.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 3: Laura.malato = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
}
case 9: switch (global.playerdead){
case 0: Fabio.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 1: Tatiana.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 2: Lucas.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
case 3: Laura.morte = 1;
instance_create(1056, 0, obj_foglio_giorno1);
instance_destroy();
mouse_clear(mb_left);
}
}
OBJ_FOGLIO_GIORNO1 - CREATE EVENT
switch(situazione[global.day]){
case 0: sprite_index = spr_g1s0;
case 1: sprite_index = spr_g1s1;
case 2: sprite_index = spr_g1s2;
case 3: sprite_index = spr_g1s3;
case 4: sprite_index = spr_g1s4;
case 5: sprite_index = spr_g1s5;
case 6: sprite_index = spr_g1s6;
case 7: sprite_index = spr_g1s7;
case 8: switch (global.playermalato){
case 0: sprite_index = spr_g1s8_1;
case 1: sprite_index = spr_g1s8_2;
case 2: sprite_index = spr_g1s8_3;
case 3: sprite_index = spr_g1s8_4;
}
case 9: switch (global.playerdead){
case 0: sprite_index = spr_g1s9_1;
case 1: sprite_index = spr_g1s9_2;
case 2: sprite_index = spr_g1s9_3;
case 3: sprite_index = spr_g1s9_4;
}
}
OBJ_CONTROLLORE (placed in the second room of the game) - DRAW EVENT
x=70;
y=120;
draw_set_font(Rudiment_font);
draw_set_colour(c_black);
//+30px in y
//Fabio
if (Fabio.stanco == 1){
draw_text(x,y,'Fabio è stanco');
} else if (Fabio.pazzo == 1){
draw_text(x,y,'Fabio è fuori di sè');
} else if (Fabio.malato == 1){
draw_text(x,y,'Fabio è malato');
} else if (Fabio.morte == 1){
draw_text(x,y,"Fabio è deceduto");
} else {
draw_text(x,y,'Fabio sta bene');
}
//Tatiana
if (Tatiana.stanco == 1){
draw_text(x-5,y+40,'Tatiana è stanca');
} else if (Tatiana.pazzo == 1){
draw_text(x-5,y+40,'Tatiana è fuori di sè');
} else if (Tatiana.malato == 1){
draw_text(x-5,y+40,'Tatiana è malata');
} else if (Tatiana.morte == 1){
draw_text(x-5,y+40,"Tatiana è deceduta");
} else {
draw_text(x-5,y+40,'Tatiana sta bene');
}
//Lucas
if (Lucas.stanco == 1){
draw_text(x,y+80,'Lucas è stanco');
} else if (Lucas.pazzo == 1){
draw_text(x,y+80,'Lucas è fuori di sè');
} else if (Lucas.malato == 1){
draw_text(x,y+80,'Lucas è deceduto');
} else if (Lucas.morte == 1){
draw_text(x,y+80,"Lucas non c'è più");
} else {
draw_text(x,y+80,'Lucas sta bene');
}
//Laura
if (Laura.stanco == 1){
draw_text(x,y+120,'Laura è stanca');
} else if (Laura.pazzo == 1){
draw_text(x,y+120,'Laura è fuori di sè');
} else if (Laura.malato == 1){
draw_text(x,y+120,'Laura è deceduta');
} else if (Laura.morte == 1){
draw_text(x,y+120,"Laura non c'è più");
} else {
draw_text(x,y+120,'Laura sta bene');
}
//Controlli oggetti
draw_text(x,y+160,'Cibo: '+string(global.cibo));
draw_text(x,y+200,'Acqua: '+string(global.acqua));
if (global.medikit==1){
draw_text(x,y+240,'Abbiamo un medikit');
} else {
draw_text(x,y+240,'Non abbiamo un medikit');
}
if (global.fucile==1){
draw_text(x,y+280,'Abbiamo un fucile');
} else {
draw_text(x,y+280,'Non abbiamo un fucile');
}
draw_text(x,y+320,'Munizioni: '+string(global.munizioni));
if (global.valigia==1){
draw_text(x,y+360,'Abbiamo una valigia');
} else {
draw_text(x,y+360,'Non abbiamo una valigia');
}
if (global.mappa==1){
draw_text(x,y+400,'Abbiamo una mappa');
} else {
draw_text(x,y+400,'Non abbiamo una mappa');
}
Through "OBJ_CONTROLLORE" I can monitor the final results, but there is a problem: it is as if several cases were calculated at the same time! Why this problem? What did I do wrong?
Please, I'm going crazy by three hours on this program and I don't understand what's wrong..
Pls help me <3