My first experiments with mouse detection and image rotation

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
dementia_patient567
Prole
Posts: 12
Joined: Sun Jan 27, 2013 6:00 am

My first experiments with mouse detection and image rotation

Post by dementia_patient567 »

I think I've been doing decent here, but there's obviously something wrong. I wanted to make the rotation centered at the middle of the picture, not the ship.x point. However it doesn't seem like using the (ship.x+imgs.ship:getWidth())/2 is getting me that...

Any help guys?

game.love
(1.81 KiB) Downloaded 280 times
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: My first experiments with mouse detection and image rota

Post by Nixola »

Check out the offset arguments of love.graphics.draw
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
dementia_patient567
Prole
Posts: 12
Joined: Sun Jan 27, 2013 6:00 am

Re: My first experiments with mouse detection and image rota

Post by dementia_patient567 »

That's what I was thinking about...What exactly ARE the offsets? I noticed them in other people's sources but I don't really know what they are.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: My first experiments with mouse detection and image rota

Post by Nixola »

They move the ship image left and up by their amount, and the ship image rotation center by their amount right and down. Example, to rotate an image around its center:

Code: Select all

love.graphics.draw(ship.image, ship.x, ship.y, ship.rotation, 1, 1, ship.image:getWidth()/2, ship.image:getHeight()/2)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
dementia_patient567
Prole
Posts: 12
Joined: Sun Jan 27, 2013 6:00 am

Re: My first experiments with mouse detection and image rota

Post by dementia_patient567 »

Awesome! I've been wanting this. Thank you!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Google [Bot] and 4 guests