Michoh
Member
Hello, I'm new around here and with Game Maker Studio 2. I don't know about coding, so I use DnD instead.
I want to create a character selection menu, so when you press spacebar to select a character, you can't move the selector, but I want you to press spacebar again to cancel and be free to select character again. To do so I give 1 or 0 to a variable depending on if you pressed spacebar to select or not. It works once, to restrain your movement and don't let you move, but if you press it again, does not work
(this is the event what occurs when you press spacebar)
If you press once, works, if you press twice, variable jchsok2 should be returned to it original value, but it's not working, I don't understand... What is not working?
If you could explain to me in DnD I'd be very grateful. Thanks and sorry for my poor english and zero knowledge about code and GMS2
Default value is 1, if I press once, it drops to 0, but pressing twice, does not get it to 1 again :T
I want to create a character selection menu, so when you press spacebar to select a character, you can't move the selector, but I want you to press spacebar again to cancel and be free to select character again. To do so I give 1 or 0 to a variable depending on if you pressed spacebar to select or not. It works once, to restrain your movement and don't let you move, but if you press it again, does not work
(this is the event what occurs when you press spacebar)
GML:
// Si variable
if(jchsok2 == 0)
{
// Asignar variable
jchsok2 = 1;
}
// Si variable
if(jchsok2 == 1)
{
// Asignar variable
jchsok2 = 0;
}
If you could explain to me in DnD I'd be very grateful. Thanks and sorry for my poor english and zero knowledge about code and GMS2
Default value is 1, if I press once, it drops to 0, but pressing twice, does not get it to 1 again :T