Search found 2 matches

by bbashar
Thu May 27, 2021 12:50 pm
Forum: General
Topic: Iterating through a table of keyboard keys
Replies: 5
Views: 6889

Re: Iterating through a table of keyboard keys

You shouldn't care about using a few bytes more or less of memory. It doesn't matter in the slightest. What you should care about though is using the correct type of input. If your game uses W/A/S/D for movement and your code responds only to the literal keycode instead of the more appropriate posi...
by bbashar
Wed May 26, 2021 1:57 pm
Forum: General
Topic: Iterating through a table of keyboard keys
Replies: 5
Views: 6889

Iterating through a table of keyboard keys

When I started with LÖVE, I used to have an ugly bunch of keyboard callback checks, like these in the code below: function love.keypressed(key) if key == 'd' then player.right = true end if key == 'a' then player.left = true end end function love.keyreleased(key) if key == 'd' then player.right = fa...