Need help with moving a Sprite with a keyboard....

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
NanoSpace
Prole
Posts: 7
Joined: Sat Feb 25, 2012 10:18 pm

Need help with moving a Sprite with a keyboard....

Post 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? :roll:
Attachments
test.love
(5.02 MiB) Downloaded 122 times
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Need help with moving a Sprite with a keyboard....

Post 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.
Kurosuke needs beta testers
User avatar
NanoSpace
Prole
Posts: 7
Joined: Sat Feb 25, 2012 10:18 pm

Re: Need help with moving a Sprite with a keyboard....

Post by NanoSpace »

I did not see that..I need to look at my code better next time.. thanks! :awesome:
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests