P
PilsZuiger
Guest
Hi I wrote this code voor a topography game:
The player should click on the correct answer. If the player clicks an answer this script gets executed. The argument0 & argument1 are the questions matching the answer the player clicked. So in the first if statement it checks if the answer is correct and if it is it randomly changes the question sprite and adds 1 onto the var that checks at which question the player is.
In the second if statement it check wether the player is at the final question or not. In the else it says what should happen if the answer of the player is wrong.
But it looks like both of the if statements arent triggers at all... How can I fix it what could be wrong?
Code:
currentquestion = object_get_sprite(obj_topoquest);
if((currentquestion == argument0 ||currentquestion == argument1) && global.vraagtopo <9){
ding = random_range(0, 23);
switch(ding){
case 0: with(obj_topoquest) sprite_index = spr_drenthevr1
case 1: with(obj_topoquest) sprite_index = spr_drenthevr2;
case 2: with(obj_topoquest) sprite_index = spr_noordhollandvr1;
case 3: with(obj_topoquest) sprite_index = spr_noordhollandvr2;
case 4: with(obj_topoquest) sprite_index = spr_zuidhollandvr1;
case 5: with(obj_topoquest) sprite_index = spr_zuidhollandvr2;
case 6: with(obj_topoquest) sprite_index = spr_frieslandvr1;
case 7: with(obj_topoquest) sprite_index = spr_frieslandvr2;
case 8: with(obj_topoquest) sprite_index = spr_groningenvr1;
case 9: with(obj_topoquest) sprite_index = spr_groningenvr2;
case 10: with(obj_topoquest) sprite_index = spr_brabantvr1;
case 11: with(obj_topoquest) sprite_index = spr_brabantvr2;
case 12: with(obj_topoquest) sprite_index = spr_limburgvr1;
case 13: with(obj_topoquest) sprite_index = spr_limburgvr2;
case 14: with(obj_topoquest) sprite_index = spr_flevolandvr1;
case 15: with(obj_topoquest) sprite_index = spr_flevolandvr2;
case 16: with(obj_topoquest) sprite_index = spr_overijsselvr1;
case 17: with(obj_topoquest) sprite_index = spr_overijsselvr2;
case 18: with(obj_topoquest) sprite_index = spr_utrechtvr1;
case 19: with(obj_topoquest) sprite_index = spr_utrechtvr2;
case 20: with(obj_topoquest) sprite_index = spr_gelderlandvr1;
case 21: with(obj_topoquest) sprite_index = spr_gelderlandvr2;
case 22: with(obj_topoquest) sprite_index = spr_zeelandvr1;
case 23: with(obj_topoquest) sprite_index = spr_zeelandvr2;
}
global.vraagtopo += 1;
}
if(global.vraagtopo == 9 || global.vraagtopo >9){
//insert here what should happen once the game is over
}
else{
//insert here what should happen if player's anwser is wrong
sound_play(snd_ohno);
}
In the second if statement it check wether the player is at the final question or not. In the else it says what should happen if the answer of the player is wrong.
But it looks like both of the if statements arent triggers at all... How can I fix it what could be wrong?