Moving an image to a specefic coordinates

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
kingomar
Prole
Posts: 37
Joined: Mon Mar 17, 2014 8:01 pm

Moving an image to a specefic coordinates

Post by kingomar »

Hello Everyone! im trying to find an effective solution to move my image to specific coordinates Fast!
I tried this way:

Code: Select all

function diliupdate(dt)
if DilutionState == "MoviePippeteMode" then
if Pippete1X ~= (TheX - Pippete1:getWidth() / 2) then
Pippete1X = Pippete1X +  
end
if Pippete1Y ~= (TheY) then
Pippete1Y = Pippete1Y - 2
end
end
end
But that was like really slow and sometimes it misleads the coordinates im trying to reach! Does anyone have any suggestion? Thank you!
Check out my game:
- Youtube Video : http://goo.gl/91x6dT
- Download Link : http://goo.gl/6llhmp
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Moving an image to a specefic coordinates

Post by Ranguna259 »

Code: Select all

Pippete1X = Pippete1X + 
You wrote "+" but.. plus what ?
Try doing this:

Code: Select all

x = x + speed*dt
y = y + speed*dt
The "speed" variable is the variable that determines how fast the "numbers" change and always add dt because of reasons ( the "x" and "y" variables are the variables that contain the coordinates)
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
Snuux
Prole
Posts: 49
Joined: Sun Dec 15, 2013 10:43 am
Location: Russia, Moskow
Contact:

Re: Moving an image to a specefic coordinates

Post by Snuux »

This is good tutorial about this http://love2d.org/wiki/Tutorial:Fire_Toward_Mouse
My library for easy saving Slib! Try this! Now you can encrypt your save!
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests