Page 1 of 1

A hot potato

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

Re: A hot potato

Posted: Wed Apr 17, 2019 9:38 pm
by dusoft
Post your code. Also, this belongs to Support & Dev, not General.

Re: A hot potato

Posted: Fri Apr 19, 2019 9:01 am
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.

Re: A hot potato

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

Re: A hot potato

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

Code: Select all

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

end