Page 1 of 1

KeyConstant

Posted: Sat Dec 26, 2009 2:00 pm
by poorenglish
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
the link is http://love2d.org/docs/KeyConstant.html

Re: KeyConstant

Posted: Sat Dec 26, 2009 2:05 pm
by Robin
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.

Re: KeyConstant

Posted: Thu Dec 31, 2009 1:10 am
by Garotas*Gostosas
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. :cry:
left and right are inverted, too. check my .love out
i'm on a macbook with 10.5
arrow.love
see source, then play
(26.27 KiB) Downloaded 491 times
PS: happy new year everybody!

Re: KeyConstant

Posted: Thu Dec 31, 2009 4:33 am
by bmelts
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.

Re: KeyConstant

Posted: Thu Dec 31, 2009 12:00 pm
by Garotas*Gostosas
oops! :oops: tanks anjo, you're the man!