flyinian
Member
I am trying to get a sprite to switch through three sub images.
If the player doesn't have the requirements to activate the button, display sub image 2.
If the player has the requirements, Turn the sprite to sub image 1.
if the player has the requirements and clicks on the sprite/instance, turn the sub image to 0.
If the player clicks on the instance when its on sub image 0, turn the sub image back to 1.
It starts in sub image 2 (Not allowed) until I meet the requirement (Number >= 10). Once I meet the requirement and I click on the instance, it won't stay on sub image 0. I can see it blink to sub image 0 but reverts back to sub image 1.
Create Event:
Step Event:
Thank you.
If the player doesn't have the requirements to activate the button, display sub image 2.
If the player has the requirements, Turn the sprite to sub image 1.
if the player has the requirements and clicks on the sprite/instance, turn the sub image to 0.
If the player clicks on the instance when its on sub image 0, turn the sub image back to 1.
It starts in sub image 2 (Not allowed) until I meet the requirement (Number >= 10). Once I meet the requirement and I click on the instance, it won't stay on sub image 0. I can see it blink to sub image 0 but reverts back to sub image 1.
Create Event:
GML:
Number = 0;
_Active = false;
_Allow = false;
Step Event:
GML:
if (Number <= 10)
{
_Allow = false;
_SpriteSubImage = 2;
};
else
{
_Allow = true;
_SpriteSubImage = 1;
};
if (mouse_check_button_pressed(mb_left) && position_meeting(mouse_x, mouse_y, id) && _Allow = true)
{
if (_Active)
{
_Active = false;
_SpriteSubImage = 1;
show_debug_message("Deactivated");
}
else
{
_Active = true;
_SpriteSubImage = 0;
show_debug_message("Activated");
}
};