For my game, I am trying to implement a 4 way cardinal attack, similar to hollow knights slashing, however In the process I cannot attack and full hop (holding a jump input) simultaneously due to action id having trouble reading multiple inputs, any advice about how I could go about implementing this would be appreciated.
I would make a variable
-- in init
self.is_jumping = false
-- on input
--code for reading input
if action.pressed then self.is_jumping = true
else if action.released then self.isjumping = false
end
And then in place where you do attack check if self.is_jumping is true alongside input
I don’t quite understand this.
Each key or other input event (mapped in input bindings) that is triggered in a frame will generate a call to the on_input() lifecycle event. This means that you may get multiple calls to the on_input() function in a frame. Use action_id
to determine which event it is and apply the appropriate game logic.
as a print of my action_id in use, while holding up and right
DEBUG:SCRIPT: hash: [Right]
DEBUG:SCRIPT: hash: [Up]
DEBUG:SCRIPT: hash: [Right]
DEBUG:SCRIPT: hash: [Up]
DEBUG:SCRIPT: hash: [Right]
DEBUG:SCRIPT: hash: [Up]
DEBUG:SCRIPT: hash: [Right]
DEBUG:SCRIPT: hash: [Up]
DEBUG:SCRIPT: hash: [Right]
Yes? It looks like you are getting both Right and Up, one after the other, exactly as expected.
Oh I thought every print line was a frame
No.
Put a print in your update() function, and you’ll see.