N
Nexusrex
Guest
Hi there! I was working on something using joystick, like moving a menu through arrow keys in the joystick. But the menu keeps changing, not like, checks if it's only pressed. I did think of using a var to check if pressed or not but I'm using switch so it didn't work. Here is the code i'm using:
Thanks in advance
Code:
if joystick_exists(1) {
switch (joystick_direction(1))
{
case vk_numpad4:
if(!numpad4_hold)
{
image_index -= 1;
if image_index < 0
{
image_index = 4;
}
numpad4_hold = true
}
break;
case vk_numpad6:
if(!numpad6_hold)
{
image_index += 1;
if image_index > 4
{
image_index = 0;
}
numpad6_hold = true
}
break;
}
}