I
IcyPenguin_
Guest
Hey all. I'm testing out some systems for a new project, and I've got an object drawing out some stats so I can see whether or not the system itself is working. I've got a parent object called prt_powerup, and in its create event, it establishes the name of the powerup so that it can be added to the inventory.
In the inventory, I have a for loop in the step event that states the following. It is triggered when the player collides with a powerup using the place_meeting function:
Just in case something is wrong with the draw event, here's the code for that.
When I pick up blue before red, the code works. If I pick up red before blue, both slot contents from the draw event state "blue". Is there something different that I could do to fix this? Am I missing something here?
In the inventory, I have a for loop in the step event that states the following. It is triggered when the player collides with a powerup using the place_meeting function:
Code:
var i;
for(i = 0; i < array_length_1d(slot)-1; i++)
{
if slot[i] == "" //If there is an empty slot...
{
slot[i] = prt_powerup.color_name; //...then make the slot carry that color.
i = array_length_1d(slot)-1; //Ends the for loop if an empty slot is found
}
}
Code:
draw_self();
draw_set_font(fnt_test);
draw_set_color(c_black);
draw_text(prt_player.x,prt_player.y-13,"Contents of Slot 0: "+slot[0]);
draw_text(prt_player.x,prt_player.y,"Contents of Slot 1: "+slot[1]);
draw_text(prt_player.x,prt_player.y-26,"Selected Slot: "+string(selected_slot));