Page 2 of 3

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Wed Oct 14, 2015 10:13 pm
by davisdude
Hi,

Could you upload the .love? Everything looks fine on a quick cursory search, but I have some questions/notes:
- All the functions where you give the camera an x and y position (except :setWorld), those x and y positions are for the center of the camera.
- When is the function love.draw/UpdateScene called?
- What are the values of campos?

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Oct 15, 2015 2:44 pm
by Fantos
Of course, here it is, and thank you for your help. There are blocks between the rooms and in the platform.lua I get in these coordinations in the campos table.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Oct 15, 2015 11:33 pm
by davisdude
Hey- I think the error might be related to STI- try updating to the newest version.
The newest version of STI requires you change your map type. I'm fairly certain this is the source of the error. If it still occurs upon updating, let me know.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Fri Oct 16, 2015 1:00 am
by Fantos
I updated (STI and Tiled too) but the problem still occur. I'm not sure what you meant by "map type" but I tried every layer format and nothing changed.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Fri Oct 16, 2015 1:20 am
by davisdude
Could you upload the newest .love?
Thanks

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Fri Oct 16, 2015 11:00 am
by Fantos
Nothing changed really beside sti and the map file, but here it is.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Fri Oct 16, 2015 9:02 pm
by davisdude
Hey, I can't seem to figure out what the problem is. Sorry.
Give me some time to look over it some more.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Sat Oct 17, 2015 12:54 am
by davisdude
Alright, I figured out the problem:
STI is using canvases to draw the map. This is good for speed, but not so good for the camera. If you comment out lines 760 and 774 of STI/map.lua, it will work.

*edit: Added a basic working example

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Sat Oct 17, 2015 9:49 am
by Fantos
Thank you for your help. Shouldn't cam:adjustscale put the camera's picture on the whole window? I wroted poorly and I'm so sorry for that but the problem was the blue rectangle from the first picture is not the whole picture on the screen

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Sat Oct 17, 2015 10:08 am
by davisdude
No, what you have is working how it should in terms of that. Check out the documentation for camera.new.

Also, :adjustScale keeps the scaling of the camera within the world boundaries.