Edits: can't and right arrow key.
i have a big isue with update(dt), i can't(sorry for the fault) make my character move even if i press the right arrow (come on, that one was clear though)key.
I made a test to see if i can increment a value.
var = 10
rate = 3
function love.update(dt)
if love.keyboard.isDown("a") then
end
if love.keyboard.isDown("s") then
var = var + 1
end
end
function love.draw(...)
love.graphics.print(var,100,100)
end
it doesn't work. so i think i has something to do with the engine.
I've tried to download another version, but it still the same.
That's so annoying! please help me.
A big issue with love.update(dt)
A big issue with love.update(dt)
Last edited by Pospos on Mon Jun 19, 2017 7:47 pm, edited 1 time in total.
Re: A big issue with love.update(dt)
Try using scancodes instead of regional keyboard characters (you get this by default).
Re: A big issue with love.update(dt)
it doesn't work.
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: A big issue with love.update(dt)
Saying "it doesn't work" doesn't tell us a whole lot about what you need help with. I ran your code, and it does exactly what you told it to do, do you mind being more specific in what you want it to do?
Last edited by Sir_Silver on Sun Jun 18, 2017 8:46 pm, edited 1 time in total.
Re: A big issue with love.update(dt)
For example: Have you tried comparing "keypressed" key value and scancode to what you currently use? Whether or not it is equal to what you expect it to be.
Besides that. I saw no problem with the code you posted either. It was counting up by 1 per frame when "s" is pressed.
Besides that. I saw no problem with the code you posted either. It was counting up by 1 per frame when "s" is pressed.
Re: A big issue with love.update(dt)
Yeah, i've tried all these, but the games prints the value on screen, but doesnt increment it.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: A big issue with love.update(dt)
Well then, i think it's time you gave us the whole file you were trying to run!
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: A big issue with love.update(dt)
that's the whole file.
it's just a content.love with this main lua on it.
it's just a content.love with this main lua on it.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: A big issue with love.update(dt)
Okay, then let's decrypt your question.
By your own admission, this is your whole main.lua, and you use nothing else:
Code: Select all
var = 10
rate = 3
function love.update(dt)
if love.keyboard.isDown("a") then
end
if love.keyboard.isDown("s") then
var = var + 1
end
end
function love.draw(...)
love.graphics.print(var,100,100)
end
Code: Select all
var = 10
function love.update(dt)
if love.keyboard.isDown("s") then
var = var + 1
end
end
function love.draw(...)
love.graphics.print(var,100,100)
end
In any case, the above code will increment your variable named var with 1 as long as you hold down the "s" key.
It will increment it more than once, of course, since the update function gets called many times each second, along with the draw function.
By "right key", you mean the "correct" key, or the "right arrow" key?
And do you mean you can't make your character move? Because if you can, then that would imply you not having a problem...
And if you can't, and you expect the right arrow to work when you're not testing for it... then i sadly can't help you further.
After you read all this, feel free to alter your question so that we may give you a better answer.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: A big issue with love.update(dt)
Ok, i understand.
I don't have a QWERTY beacause i'm using a french keyboard, so i should probably use the scancode function.
but this code used to work on another keyboard non-QWERTY.
I don't have a QWERTY beacause i'm using a french keyboard, so i should probably use the scancode function.
but this code used to work on another keyboard non-QWERTY.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 10 guests