R
RealsLife
Guest
If been trying to make bigger and advanced menu's with 2d array but it seems like I never fully understood the whole process?
I always thought first the step event was checked and after that the draw event was executed. For example some small code that needs to be explained(if you can).
if I put it like this I will get an error because for some reason b will stay 2 and after it is drawn it is checked but if I remove the if(echte_arr_size+1 <3) then b will be 0 and it will work but I mean why does b change without the echte_arr_size check but not with it. The echte_arr_size var is correct I think and works like this
I've much more code but this is just enough to show you this small example. I've been busy with a character creation menu for weeks ugh I just don't get it I tried checking before a variable changes I tried checking it after and yes if I put a check in the draw event the whole thing will already work partly but I don't think I get the whole picture can someone explain this?
EDIT:
yea draw event is for drawing
step event is for checking but read my post first I don't get it... :/
I always thought first the step event was checked and after that the draw event was executed. For example some small code that needs to be explained(if you can).
Code:
//create event
arr_lengte = array_length_2d(arr_creationmenu, i)-1;
arr_hoogte = array_height_2d(arr_creationmenu)-1;
Code:
if(keyboard_check_pressed(down)){
i = 0;
a = 1;
if(echte_arr_size +1 < 3)
{
b = 0;
}
else
{
b = 2;
}
j++;
}
Code:
if(j == t && i == z)//the current selection
{
if(j > 1 && j < 5)
{
draw_sprite_ext(arr_creationmenu[j,i],0,100,50*t,1,1,0,c_white,1);
draw_sprite_ext(arr_creationmenu[j,i+a],0,150,50*t,1.5,1.5,0,c_lime,1);
draw_sprite_ext(arr_creationmenu[j,i+b],0,200,50*t,1,1,0,c_white,1);
}
else
{
draw_sprite_ext(arr_creationmenu[j,i],0,100+50*z,50*t,1,1,1,c_white,1);
}
}
if I put it like this I will get an error because for some reason b will stay 2 and after it is drawn it is checked but if I remove the if(echte_arr_size+1 <3) then b will be 0 and it will work but I mean why does b change without the echte_arr_size check but not with it. The echte_arr_size var is correct I think and works like this
Code:
aantal = 0;
for(k =3;0 <= k;k--)
{
if(arr_creationmenu[j,k] == -1){aantal += 1;}
}
vorige_j = j;
echte_arr_size = arr_lengte-aantal;
EDIT:
yea draw event is for drawing
step event is for checking but read my post first I don't get it... :/