Cameras in Love2D (Tutorials)

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.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Cameras in Love2D (Tutorials)

Post by T-Bone »

Consider adding them to the wiki, they are much easier to find there.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Cameras in Love2D (Tutorials)

Post by BlackBulletIV »

Will do. :)
User avatar
Cantide
Prole
Posts: 10
Joined: Mon Jul 25, 2011 7:01 pm

Re: Cameras in Love2D (Tutorials)

Post by Cantide »

Thanks for the awesome tutorials and code :D I've just implemented it tonight, and it works really well.
Just one problem I've had... my mouse cursor position doesn't seem to update as the camera moves. How would I be able to correct this? :|
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Cameras in Love2D (Tutorials)

Post by BlackBulletIV »

Thanks for the feedback.
Cantide wrote:my mouse cursor position doesn't seem to update as the camera moves. How would I be able to correct this? :|
Can you explain what you mean?
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Cameras in Love2D (Tutorials)

Post by TechnoCat »

BlackBulletIV wrote:Thanks for the feedback.
Cantide wrote:my mouse cursor position doesn't seem to update as the camera moves. How would I be able to correct this? :|
Can you explain what you mean?
I'm assuming love.mouse.getPosition()
You'll have to do the same transformations you do to the camera, to the cursor positions.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Cameras in Love2D (Tutorials)

Post by BlackBulletIV »

If that's the case, then I explained that in part 1. Although I didn't show it in the tutorial (as it's a matter of taste), I personally redefine love.mouse.getPosition/getX/getY to do those transformations.
User avatar
Cantide
Prole
Posts: 10
Joined: Mon Jul 25, 2011 7:01 pm

Re: Cameras in Love2D (Tutorials)

Post by Cantide »

Technocat, I tried to do it that way, but it didn't work properly.... I can't even begin to describe the bug I was getting. *_*
After checking the tutorials again I got it right, thanks BlackBulletIV! :)
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Cameras in Love2D (Tutorials)

Post by TechnoCat »

Cantide wrote:Technocat, I tried to do it that way, but it didn't work properly.... I can't even begin to describe the bug I was getting. *_*
After checking the tutorials again I got it right, thanks BlackBulletIV! :)
You'll have to do it in reverse order.
X -> X' camera translation
X' -> X cursor translation
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Cameras in Love2D (Tutorials)

Post by BlackBulletIV »

Cantide wrote:After checking the tutorials again I got it right, thanks BlackBulletIV! :)
Glad to be of help!
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Cameras in Love2D (Tutorials)

Post by The Burrito »

Nice tutorial, these camera coords are top left correct? if so I might recommend adding a centering option to the set position and scalar, zooming especially looks really confusing if the camera doesn't stay centered on the same point.
Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests