Cameras in Love2D (Tutorials)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Cameras in Love2D (Tutorials)
Consider adding them to the wiki, they are much easier to find there.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Cameras in Love2D (Tutorials)
Thanks for the awesome tutorials and code 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?
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?
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Cameras in Love2D (Tutorials)
Thanks for the feedback.
Can you explain what you mean?Cantide wrote:my mouse cursor position doesn't seem to update as the camera moves. How would I be able to correct this?
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Cameras in Love2D (Tutorials)
I'm assuming love.mouse.getPosition()BlackBulletIV wrote:Thanks for the feedback.Can you explain what you mean?Cantide wrote:my mouse cursor position doesn't seem to update as the camera moves. How would I be able to correct this?
You'll have to do the same transformations you do to the camera, to the cursor positions.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Cameras in Love2D (Tutorials)
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.
Re: Cameras in Love2D (Tutorials)
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!
After checking the tutorials again I got it right, thanks BlackBulletIV!
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Cameras in Love2D (Tutorials)
You'll have to do it in reverse order.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!
X -> X' camera translation
X' -> X cursor translation
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Cameras in Love2D (Tutorials)
Glad to be of help!Cantide wrote:After checking the tutorials again I got it right, thanks BlackBulletIV!
- The Burrito
- Party member
- Posts: 153
- Joined: Mon Sep 21, 2009 12:14 am
- Contact:
Re: Cameras in Love2D (Tutorials)
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.
Who is online
Users browsing this forum: Google [Bot] and 0 guests