Hi,
I have some semi-working code in my project that runs a script when the player clicks on certain tiles in-game. I'm struggling with slowing things down to get a smooth look!
What I want to happen is:
Here is the code relevant to the bar being triggered:
This is how it looks in runtime:
(I've set the value for obj_player.element_pickup_charge to be really high thinking the amount of loop iterations would take longer, am I wrong for thinking so??)
I've tried altering the integers used in my for loop code, but nothing seems to slow the process down! I've also looked in the manual and there aren't any YouTube videos I could find that match my problem / search. Any advice or pointers would be helpful and much appreciated.
Thanks in advance!
I have some semi-working code in my project that runs a script when the player clicks on certain tiles in-game. I'm struggling with slowing things down to get a smooth look!
What I want to happen is:
- The player clicks the tile.
- A small blue bar appears in the tile below and fills from left to right.
- Once the bar has filled, the bar disappears and the selected tile gets added to the players inventory.
Here is the code relevant to the bar being triggered:
GML:
if (mouse_check_button_pressed(mb_left) && (_dataWater!= 0))
{
//Charge effect - draw blue bar underneath tile
for (var i = 0; i < obj_player.element_pickup_charge; i++)
{
var _percent = i / obj_player.element_pickup_charge;
draw_set_alpha(0.3);
draw_rectangle_color((mx div _cs) * TILE_SIZE, ((my div _cs) * TILE_SIZE) + TILE_SIZE + 5,
(_gx * TILE_SIZE) + (_percent * TILE_SIZE), (_gy * TILE_SIZE) + TILE_SIZE + 7, c_blue, c_blue, c_blue, c_blue, false );
draw_set_alpha(1);
}
ElementListAdd(EL_TYPE.WATER);
}
(I've set the value for obj_player.element_pickup_charge to be really high thinking the amount of loop iterations would take longer, am I wrong for thinking so??)
I've tried altering the integers used in my for loop code, but nothing seems to slow the process down! I've also looked in the manual and there aren't any YouTube videos I could find that match my problem / search. Any advice or pointers would be helpful and much appreciated.
Thanks in advance!