Hi! I am learning defold and going through the tutorials. I have one strange issue with the rocket spawning, which looks like it is based on inputs, on this tutorial:
If I hold any combination of (up or down) and (left or right) a rocket is spawned, except if I hold up+left. In that case, the “fire” input is not detected, as indicated by the debug print message that does not get printed.
if action_id == hash("up") then
self.new_anim = hash("player-up")
self.idle_anim = hash("idle-up")
self.input.y = 1 -- [15]
elseif action_id == hash("down") then
self.new_anim = hash("player-down")
self.idle_anim = hash("idle-down")
self.input.y = -1
elseif action_id == hash("left") then
self.new_anim = hash("player-left")
self.idle_anim = hash("idle-left")
self.input.x = -1
elseif action_id == hash("right") then
self.new_anim = hash("player-right")
self.idle_anim = hash("idle-right")
self.input.x = 1
elseif action_id == hash("fire") and action.pressed then
print("fire")
self.firing = true
end
What could cause this? Could there be an exiting binding on up+left that “shadows” the one from the game?
I have the same problem on a Lenovo laptop. But then I checked on a Macbook, everything works there. What is your operating system version? I have Windows 11. I also thought maybe because of it (I did not have time to check on another laptop with Windows 10).
I understand, I also fixed it. I’m wondering if the specific problem is the keyboard or the operating system… If cheap keyboards can’t handle multiple (in this case 3 buttons), then why don’t Left+Up+Space work, but Left+Up+Z do? Or it has to do with configuration and signal transmission.
I’m just starting with Defold and was hitting my head with this wall, i am using Linux MX and have the same problem, using space only shots diagonal “TOP-UP”, i didn’t meet this issue before and the not logical behavior of the problem cannot allow me to sleep.
This is not related with Defold, the problem is reproducible here https://keyboardchecker.com/
And the reason for this already is documented here Key rollover - Wikipedia.
Using Z solve the issue for me too, thanks.