love.keypressed not working as expected.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
DPS2004
Prole
Posts: 3
Joined: Thu Jan 23, 2020 8:05 pm

love.keypressed not working as expected.

Post by DPS2004 » Thu Jan 23, 2020 8:20 pm

Hello, I am coming here for help with a project.

I am porting my Ludum Dare 45 game, Buzzsaw Cat to love2d. I wrote it in PICO-8.

One reason for the port is to use it with LovePotion on my 3DS.

LovePotion uses love.gamepadpressed and love.gamepadreleased to check for input, so for the computer version, I am using keypressed and keyreleased.

I am trying to convert the inputs to PICO-8's BTN() format. The game opens with a title screen that waits for the user to press button 5. Button 5 is mapped to the space bar under my current system. The game does not detect that the space bar is being pressed, and therefore does not activate Button 5 in the PICO-8 code. The console window is monitoring the state of button 5, and as you can see, it is returning a stream of false's.

I do not know if this is helpful, but I noticed that keyreleased is working. If you start all buttons as pressed, upon releasing space, it unpresses the button.

Any sort of help would be appreciated.
Attachments
ld45.love
the .love file
(36.39 KiB) Downloaded 26 times

steVeRoll
Party member
Posts: 114
Joined: Sun Feb 14, 2016 1:13 pm

Re: love.keypressed not working as expected.

Post by steVeRoll » Fri Jan 24, 2020 6:37 am

Hi and welcome to the forums!
The love.keypressed which is at line 90 seems to work correctly, but you are overwriting it with an empty love.keypressed on line 189. Removing it seems to have fixed the issue.

DPS2004
Prole
Posts: 3
Joined: Thu Jan 23, 2020 8:05 pm

Re: love.keypressed not working as expected.

Post by DPS2004 » Fri Jan 24, 2020 12:55 pm

Amazing! Thank you so much for the help.

Post Reply

Who is online

Users browsing this forum: CanYouReply, steVeRoll and 32 guests