Code: Select all
function love.keyboard.isDown(q)
function love.keypressed(q)
if q == 'escape' then
love.event.push('q')
end
end
end
Code: Select all
function love.keyboard.isDown(q)
function love.keypressed(q)
if q == 'escape' then
love.event.push('q')
end
end
end
Code: Select all
function love.keypressed(key)
if key == "escape" then
love.event.push('q')
end
end
Code: Select all
function love.update(dt)
if love.keyboard.isDown("escape") then
love.event.push('q')
end
end
Now that's just weird. Here's how you'd do it:trlestew wrote:well I tried one sort of updating, I think. I tried setting to if the player has pressed "q", the application will exit. I honestly have no clue what I'm doing...Code: Select all
function love.keyboard.isDown(q) function love.keypressed(q) if q == 'escape' then love.event.push('q') end end end
Code: Select all
function love.keypressed(key, unicode)
--This callback is run whenever the user presses a key
if key == "escape" then
--If that key is escape, quit the game.
love.event.push('q')
end
end
It's a callback, not a regular function-function. Unicode is simply the unicode number of the key that has been pressed.trlestew wrote:What do you mean by Unicode? :/
I thought that was some sort of encryption, what do I need to put there?
Also, I changed the code to the correct example, and still nothing.
You don't need to, you can ignore it. It is especially useful for more advanced usage of love.keypressed.trlestew wrote:What do you mean by Unicode? :/
I thought that was some sort of encryption, what do I need to put there?
Users browsing this forum: No registered users and 1 guest