F
fxokz
Guest
So basically the effect I'm trying to achieve is: when the player presses "I" a 0x0 rectangle is created in the center of the view that quickly grows to cover a about 2/3rds of the screen so that it can then display the players inventory. Its supposed to be a subtle effect to make the game look more smooth but I just cant seem to implement it. The rectangle either grows somewhere I don't intend for it to grow or doesn't grow the right width and height. its a mess..
I really didn't think I would struggle with something this simple.. heres the code I use:
create event:
draw event:
I pressed event:
I feel as if I overcomplicated things in this attempt, is there anything that could have made this much easier?
I really didn't think I would struggle with something this simple.. heres the code I use:
create event:
Code:
//obj_inventory coordinates also in step event
x = view_xview + (view_wview/2);
y = view_yview + (view_hview/2);
show_inv = 0; //boolean
//starting rect
rec_startx1 = x;
rec_starty1 = y;
rec_startx2 = x;
rec_starty2 = y;
rec_width = view_wview/2;
rec_height = view_hview/2;
//ending rect
x1 = x - rec_width/2;
x2 = x + rec_width/2;
y1 = y - rec_height/2;
y2 = y + rec_height/2;
Code:
if (show_inv)
{
draw_set_colour(c_black);
draw_set_alpha(1);
draw_roundrect(rec_startx1, rec_starty1, rec_startx2, rec_starty2, 0);
if (rec_startx1 > view_xview + x1) rec_startx1 --;
if (rec_startx2 < view_xview + x2) rec_startx2 ++;
if (rec_starty1 > view_yview + y1) rec_starty1 --;
if (rec_starty2 < view_yview + y2) rec_starty2 ++;
} else {
rec_startx1 = x;
rec_starty1 = y;
rec_startx2 = x;
rec_starty2 = y;
}
Code:
if (show_inv == 0)
{
show_inv = 1;
} else if (show_inv == 1)
{
show_inv = false;
}