## KeyConstant

General discussion about LÖVE, Lua, game development, puns, and unicorns.
poorenglish
Prole
Posts: 47
Joined: Thu Sep 24, 2009 1:49 pm

### KeyConstant

In the documents,the 0.6.0 version's KeyConstant is less than 0.50?
I find some keys are missing ,such F1 to F12,Alt,Ctrl,Shift,left,right,up,down,and so on
I try the F1,F4, find the key is useful,I think the document for 0.60 should update

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: KeyConstant

Oh, I'm sorry. I wrote that, as a test, but forgot to update it.
F1 is 'f1' etc.
the left alt key is 'lalt' etc.
the right alt key is 'ralt' etc.
the arrow keys are 'left', 'right', 'up', 'down'
See this for a complete conversion table.

Garotas*Gostosas
Prole
Posts: 41
Joined: Fri Apr 03, 2009 12:15 am

### Re: KeyConstant

is there a bug with the key constants in 0.6.0 or is it just me?
when you press "up" arrow it does "down" arrow and vice versa.
left and right are inverted, too. check my .love out
i'm on a macbook with 10.5
arrow.love
see source, then play
PS: happy new year everybody!
I LOVE GAME, YEAH!

bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

### Re: KeyConstant

In your source, you have this:

Code: Select all

function love.keypressed(k,u)

if k ~= "up" then
up = true
end
-- repeat for all the directions, in love.keyreleased too

That's saying that if the key that was pressed is not up, to set up to true. Thus, when someone presses the up arrow key, right, left, and down all get set to true -- but not up.

Right and left cancel each other out in the update phase in terms of movement, so all you see is the ball moving down, but in reality, it's moving every direction except up.

Change all those ~= to == and everything ought to function properly.

Garotas*Gostosas
Prole
Posts: 41
Joined: Fri Apr 03, 2009 12:15 am

### Re: KeyConstant

oops! tanks anjo, you're the man!
I LOVE GAME, YEAH!

### Who is online

Users browsing this forum: No registered users and 6 guests