This code is supposed to draw something when left mouse is clicked at the mouse location, but because I have a background that moves based on mouse position, I don't know how to make images seem to appear in the "new" appropriate position.
The background function is in function.lua
The uploader isn't working so: http://www.mediafire.com/?ynmkbyku2oh
Huge Impediment for me
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Huge Impediment for me
First: uploading didn't work because, well, it was too large
Second: please upload .loves, people prefer that because they can run it much more easily.
Thirdly: don't put all functions in love.update. That is a huge clusterfuck, because the functions will be bound every freakin frame.
Fourthly: you can get the mouse position with love.mouse.getPosition(). Use as followed:
Or, in your case, replace this:
by this:
and replace this:
by this:
Disclaimer: I haven't tested this at all.
Second: please upload .loves, people prefer that because they can run it much more easily.
Thirdly: don't put all functions in love.update. That is a huge clusterfuck, because the functions will be bound every freakin frame.
Fourthly: you can get the mouse position with love.mouse.getPosition(). Use as followed:
Code: Select all
local x, y = love.mouse.getPosition()
Code: Select all
if love.mouse.isDown("l") then
showEarth = true
end
Code: Select all
if love.mouse.isDown("l") then
showEarth = true
earthX, earthY = love.mouse.getPosition()
end
Code: Select all
if showEarth == true then
------planetEARTH !
---moon(s)*
love.graphics.draw(planetEarth.moon.image,planetEarth.moon.x+camera.x,planetEarth.y+camera.y, math.rad(planetEarth.angle),planetEarth.moon.width,planetEarth.moon.height,16,16)
--Earth*
love.graphics.draw(planetEarth.image,planetEarth.x+camera.x,planetEarth.y+camera.y, math.rad(planetEarth.angle),planetEarth.width,planetEarth.height,16,16)
--love.graphics.draw(planetEarth.image,planetEarth.x,planetEarth.y, math.rad(planetEarth.angle),planetEarth.width,planetEarth.height,16,16)
end
Code: Select all
if showEarth then
---moon(s)*
love.graphics.draw(planetEarth.moon.image,planetEarth.moon.x+camera.x+earthX,planetEarth.y+camera.y+earthY, math.rad(planetEarth.angle),planetEarth.moon.width,planetEarth.moon.height,16,16)
--Earth*
love.graphics.draw(planetEarth.image,planetEarth.x+camera.x+earthX,planetEarth.y+camera.y+earthY, math.rad(planetEarth.angle),planetEarth.width,planetEarth.height,16,16)
end
Help us help you: attach a .love.
Re: Huge Impediment for me
Wow, thanks to you, I ain't stuck anymore. Woot.
Who is online
Users browsing this forum: Bing [Bot] and 9 guests