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 » Wed Apr 17, 2019 8:10 am

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:

dusoft
Citizen
Posts: 98
Joined: Fri Nov 08, 2013 12:07 am

Re: A hot potato

Post by dusoft » Wed Apr 17, 2019 9:38 pm

Post your code. Also, this belongs to Support & Dev, not General.

steVeRoll
Party member
Posts: 102
Joined: Sun Feb 14, 2016 1:13 pm

Re: A hot potato

Post by steVeRoll » Fri Apr 19, 2019 9:01 am

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 » Tue Apr 23, 2019 4:59 am

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
Prole
Posts: 48
Joined: Wed Jan 02, 2019 8:44 pm

Re: A hot potato

Post by 4vZEROv » Tue Apr 23, 2019 10:24 pm

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 5 guests