Writerstix77
Member
This my take a minute, so bear with me.
I have created 6 keys for my player to pick up. They can hold multiples of each type of key. The keys are named:
oKeyYellow
oKeyWhite
oKeyGreen
oKeyBlue
oKeyRed
oKeyPurple
To denote how many of each key the play holds I have put in the oPlayer Create Event:
KeyYcount = 0
KeyWcount = 0
KeyGcount = 0
KeyBcount = 0
KeyRcount = 0
KeyPcount = 0
To show how many of each the player is carrying, I put this in the oPlayer DrawGUI Event:
if (KeyYcount > 0)
{
draw_sprite(key_yellow_sp, 0, 32, 100);
draw_text(50, 100, string("") + string(oPlayer.KeyYcount));
}
if (KeyWcount > 0)
{
draw_sprite(key_white_sp, 0, 32, 500);
draw_text(50, 500, string("") + string(oPlayer.KeyWcount));
}
if (KeyGcount > 0)
{
draw_sprite(key_green_sp, 0, 32, 200);
draw_text(50, 200, string("") + string(oPlayer.KeyGcount));
}
if (KeyBcount > 0)
{
draw_sprite(key_blue_sp, 0, 32, 300);
draw_text(50, 300, string("") + string(oPlayer.KeyBcount));
}
if (KeyRcount > 0)
{
draw_sprite(key_red_sp, 0, 32, 400);
draw_text(50, 400, string("") + string(oPlayer.KeyRcount));
}
if (KeyPcount > 0)
{
draw_sprite(key_purple_sp, 0, 32, 600);
draw_text(50, 600, string("") + string(oPlayer.KeyPcount));
}
And in each Collision Event (I made 6 separate ones; one for each key because the oParentKey wasn’t working, so I deleted it), I put:
with(other)
{
instance_destroy();
}
KeyYcount ++; // This is the Yellow key's collision event. The correct key count variable is in their respective collision events.
Finally, we arrive at the problem. I have placed a number of all these keys around my room. However, when I run the game, only some of the keys (B,R,P) are visible, the others (Y,W,G) are not. I can still pick them up, but I cannot see them, and the GUI sprite that is supposed to be drawn upon pick-up is not appearing either. I’ve triple checked spelling, and capitalization, and cannot figure out what is wrong. All objects are checked as visible (I've unchecked and rechecked this box). The other keys work just fine.
As a test, I replaced the spite for two of the keys with tree_sp and acorn_sp sprites, then changed them back to their correct Key sprites. That didn’t work, but NOW, my tree and acorn objects are now also invisible.
So… any help would be appreciated. Thanks so much.
I have created 6 keys for my player to pick up. They can hold multiples of each type of key. The keys are named:
oKeyYellow
oKeyWhite
oKeyGreen
oKeyBlue
oKeyRed
oKeyPurple
To denote how many of each key the play holds I have put in the oPlayer Create Event:
KeyYcount = 0
KeyWcount = 0
KeyGcount = 0
KeyBcount = 0
KeyRcount = 0
KeyPcount = 0
To show how many of each the player is carrying, I put this in the oPlayer DrawGUI Event:
if (KeyYcount > 0)
{
draw_sprite(key_yellow_sp, 0, 32, 100);
draw_text(50, 100, string("") + string(oPlayer.KeyYcount));
}
if (KeyWcount > 0)
{
draw_sprite(key_white_sp, 0, 32, 500);
draw_text(50, 500, string("") + string(oPlayer.KeyWcount));
}
if (KeyGcount > 0)
{
draw_sprite(key_green_sp, 0, 32, 200);
draw_text(50, 200, string("") + string(oPlayer.KeyGcount));
}
if (KeyBcount > 0)
{
draw_sprite(key_blue_sp, 0, 32, 300);
draw_text(50, 300, string("") + string(oPlayer.KeyBcount));
}
if (KeyRcount > 0)
{
draw_sprite(key_red_sp, 0, 32, 400);
draw_text(50, 400, string("") + string(oPlayer.KeyRcount));
}
if (KeyPcount > 0)
{
draw_sprite(key_purple_sp, 0, 32, 600);
draw_text(50, 600, string("") + string(oPlayer.KeyPcount));
}
And in each Collision Event (I made 6 separate ones; one for each key because the oParentKey wasn’t working, so I deleted it), I put:
with(other)
{
instance_destroy();
}
KeyYcount ++; // This is the Yellow key's collision event. The correct key count variable is in their respective collision events.
Finally, we arrive at the problem. I have placed a number of all these keys around my room. However, when I run the game, only some of the keys (B,R,P) are visible, the others (Y,W,G) are not. I can still pick them up, but I cannot see them, and the GUI sprite that is supposed to be drawn upon pick-up is not appearing either. I’ve triple checked spelling, and capitalization, and cannot figure out what is wrong. All objects are checked as visible (I've unchecked and rechecked this box). The other keys work just fine.
As a test, I replaced the spite for two of the keys with tree_sp and acorn_sp sprites, then changed them back to their correct Key sprites. That didn’t work, but NOW, my tree and acorn objects are now also invisible.
So… any help would be appreciated. Thanks so much.