C
CharlieH
Guest
Hi,
I am very new to GameMaker and I started using it 3 days ago and I found a problem.
I am using simple keyboard check as below:
I am not sure whether this is a good way of combining multiple conditions into 1.
But it works as expected.
However, when I make keyboard_check_pressed event as below, it gives me totally different results.
Variable delay_counter should only be set to 1 when I press D or A or W or S key.
However, when I press any key on my keyboard, delay_counter is set to 1.
I am not sure why because it seems work well with key_check_released event.
So I have no choice but change my code to this:
After changing my code, everything works fine. I don't see any difference between those 2 methods.
I know this is entry level codes but I am really confused. Can someone explain this?
Or is this a bug? And thanks in advance.
I am very new to GameMaker and I started using it 3 days ago and I found a problem.
I am using simple keyboard check as below:
Code:
if (keyboard_check_released(ord("D")||ord("A")||ord("W")||ord("S")))
{
image_index = 0;
}
But it works as expected.
However, when I make keyboard_check_pressed event as below, it gives me totally different results.
Code:
if (keyboard_check_pressed(ord("D")||ord("A")||ord("W")||ord("S")))
{
delay_counter = 1;
tap_counter += 1;
}
However, when I press any key on my keyboard, delay_counter is set to 1.
I am not sure why because it seems work well with key_check_released event.
So I have no choice but change my code to this:
Code:
if (keyboard_check_pressed(ord("D"))
||keyboard_check_pressed(ord("A"))
||keyboard_check_pressed(ord("W"))
||keyboard_check_pressed(ord("S"))
)
{
delay_counter = 1;
tap_counter += 1;
}
I know this is entry level codes but I am really confused. Can someone explain this?
Or is this a bug? And thanks in advance.