Keyboard
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 126
- Joined: Sat May 09, 2015 9:15 pm
Re: Keyboard
Hi,
By no means an expert but I think you could...
a) Test in love.update() using love.keyboard.isDown("key").
b) Activate a flag in love.keypressed(key) and deactivated it in love.keyreleased(key).
By no means an expert but I think you could...
a) Test in love.update() using love.keyboard.isDown("key").
b) Activate a flag in love.keypressed(key) and deactivated it in love.keyreleased(key).
Re: Keyboard
Let's translate that into code:
Method 1:
* You can put an "else <Stop Action>" if you really need it.
Method 2:
Method 1:
Code: Select all
function love.update()
...
if love.keyboard.isDown('a') then -- Let's press 'A' for example
-- Do Action
end
end
Method 2:
Code: Select all
function love.keypressed(key)
if key == 'a' then
-- Do Action
end
end
function love.keyreleased(key)
if key == 'a' then
-- Stop Action
end
end
Who is online
Users browsing this forum: Semrush [Bot] and 4 guests