Hi,
Im new to love (and lua) so I started off with something small like moving an image around but it seems like my keyboard input does not work.
I've checked out the wiki and other online tutorials and It looks like I'm doing everything right.
Can someone check out my love file and see where I'm going wrong?
any help would be appreciated! thank you!
Input not working, Help!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Input not working, Help!
- Attachments
-
- test.love
- (2.89 KiB) Downloaded 71 times
Re: Input not working, Help!
You're not technically doing anything wrong. It should work. The problem may be that the image is moving, But incredibly slow.
The one thing you are doing wrong is not using dt. There's a post on the love2d blogs that goes into what dt is, and why it's important.
But basically what you have to do is something like this:
The one thing you are doing wrong is not using dt. There's a post on the love2d blogs that goes into what dt is, and why it's important.
But basically what you have to do is something like this:
Code: Select all
function love.update(dt)
if love.keyboard.isDown("a") then
x = x - 80 * dt
end
if love.keyboard.isDown("d") then
x = x + 80 * dt
end
if love.keyboard.isDown("w") then
y = y - 80 * dt
end
if love.keyboard.isDown("s") then
y = y + 80 * dt
end
end
Re: Input not working, Help!
I'll check it out. Thanks!
Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests