31Nf4ChZ4H73N
Member
I am working on a turn based game. the order of the turns is stored in a ds_list. Sometimes the code is executed a coupple of times even though I only pressed the mouse_button once. I'm working with child objects of the battle unit. does anyone have an idea whats wrong? is it the code or what? Thank you guys in advance
Code:
///Step code of the battle_unit
if(state == wait_state)
{
if(mouse_check_button_released(mb_left))
{
next_turn();
}
}
Code:
///next_turn script
ds_list_delete(o_battle.turn_list,0);
if(ds_list_size(o_battle.turn_list) >0)
{
with(o_battle_unit)
{
state = idle_state;
}
with(o_battle.turn_list[| 0]) // o_battle.turn_list[| 0] gives back the object id
{
state = wait_state;
}
}
Last edited: