A hot potato

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
keprast
Prole
Posts: 6
Joined: Wed Apr 17, 2019 7:31 am

A hot potato

Post by keprast »

Hi, everyone. This is the new guy. :)

I have a question.
I tried to move a Sprite using a keyboard button and then draw it using the draw function.
Finally, my Sprite won't move. I have to keep clicking on the keyboard button to move it. :|
Why? :shock:
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: A hot potato

Post by dusoft »

Post your code. Also, this belongs to Support & Dev, not General.
User avatar
steVeRoll
Party member
Posts: 139
Joined: Sun Feb 14, 2016 1:13 pm

Re: A hot potato

Post by steVeRoll »

From what I can gather, you put the player's movement code inside of love.keypressed, which is only called when a key is pressed. Instead, put the movement code in love.update, and check if a key is pressed using love.keyboard.isDown.
Shirley7
Prole
Posts: 1
Joined: Tue Apr 23, 2019 4:56 am

Re: A hot potato

Post by Shirley7 »

Can u pls post code here..Bcoz from your question,figuring out information is quite difficult..So pls post your code here,then only users can help DQ Fan Survey
Last edited by Shirley7 on Wed Apr 24, 2019 4:28 am, edited 1 time in total.
User avatar
4vZEROv
Party member
Posts: 126
Joined: Wed Jan 02, 2019 8:44 pm

Re: A hot potato

Post by 4vZEROv »

Code: Select all

function love.update(dt)
	
	if love.keyboard.isDown("left")  then move_left()  end

end
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests