Page 1 of 1
Need help with moving a Sprite with a keyboard....
Posted: Sat Feb 25, 2012 10:34 pm
by NanoSpace
Well I pretty much copied the code in the Hamster tutorial...all I did was change the Sprite (picture). For some reason the sprite just follows my mouse around and I can't use any of the keyboard keys to move the sprite. I haven't seen anyone with the same problem so I'm not sure at all on why it's happening. Does anyone know?
Re: Need help with moving a Sprite with a keyboard....
Posted: Sat Feb 25, 2012 10:50 pm
by tentus
Code: Select all
local x = love.mouse.getX( )
local y = love.mouse.getY( )
love.graphics.draw( imageplayer, x, y ) --The player
You are drawing at x (the mouse X position) and y (the mouse Y position). Local variables have priority over global variables.
Re: Need help with moving a Sprite with a keyboard....
Posted: Sat Feb 25, 2012 10:59 pm
by NanoSpace
I did not see that..I need to look at my code better next time.. thanks!