Hello all,
I’m new to defold but it looks like an awesome engine. I am watching all of the live coding sessions form setthebet and it’s cool to see someone make prototypes live and uncut and really showcases the power of the engine.
I was working through a quick prototype, and I found that my input wasn’t working. I had a touch, key, and mouse input setup all called player_action. I then tried renaming each to have a unique name, and the input started working fine. I read through the input manual, and I didn’t see in the manual where it said that inputs need a unique name. This is what I came up with:
local msg_player_action = {}
msg_player_action[hash('key_player_action')] = ''
msg_player_action[hash('mouse_player_action')] = ''
msg_player_action[hash('touch_player_action')] = ''
function init(self)
msg.post(".", "acquire_input_focus")
end
function final(self)
msg.post(".", "release_input_focus")
end
function on_input(self, action_id, action)
if msg_player_action[action_id] and action.pressed then
print('We got some actions fo real!!!')
end
end