Brady- A Camera Library with Parallax Scrolling

Showcase your libraries, tools and other projects that help your fellow love users.
Fantos
Prole
Posts: 11
Joined: Sat Aug 08, 2015 9:22 am

Re: Brady- A Camera Library with Parallax Scrolling

Post by Fantos »

Okay, I played around the options, but nothing work. Sorry for my dumbness, and sorry for still asking for your help, here is what I made with gamera and that what I try to achive.
Attachments
MV platformer gamera.love
(978.88 KiB) Downloaded 172 times
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Brady- A Camera Library with Parallax Scrolling

Post by davisdude »

No, you're not at fault- the docs are pretty poorly explained as they are right now.

For instance, the function camera.new takes 4 arguments: x, y, width, and height.
All these refer to the screen, i.e. x and y are the x and y position for the location of the camera on the screen. Width and height represent the camera's width and height on a default canvas.

In order to do what you want, it would look more like this:

Code: Select all

cam = camera.new( 0, 0, love.graphics.getDimensions() )
cam:setZoom( 4.8 )
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Fantos
Prole
Posts: 11
Joined: Sat Aug 08, 2015 9:22 am

Re: Brady- A Camera Library with Parallax Scrolling

Post by Fantos »

Alright, thank you for help and patience. Turn out when I move the camera with cam:moveTo the camera just ignore adjustposition and go through the boundaries. Have a nice day.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Brady- A Camera Library with Parallax Scrolling

Post by davisdude »

The camera shouldn't be ignoring those positions. It sounds like you haven't ported over the code correctly from gamera. I'm not really familiar with it, but I'm fairly sure you could get it to work like you have it with gamera.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Brady- A Camera Library with Parallax Scrolling and Aspect Ratios

Post by davisdude »

Brady has been updated. You can find the repo here.

Major points include:

- Compatible with 0.10.0
- Aspect ratios
- Relative scale for layers (on top of the layer scale)
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Brady- A Camera Library with Parallax Scrolling

Post by davisdude »

Brady has been updated. You can find the repo here.

Updates include:

- Get the coordinates of the mouse within the world more easily with :getMouseWorldCoordinates
- Zoom into a given point (by a factor) with :scaleToPoint
- Zoom into a given point (by increment) with :incrementScaleToPoint
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests