Page 1 of 1
Advanced Tile Loader + camera
Posted: Sat Sep 29, 2012 2:22 am
by luaz
While I understand the general concept how a "camera" should work, I do not understand how to implement it with Advanced Tile Loader. How to "tie" them together, so that the collision would work and the player's movement would be synchronized with the map's scrolling.
Re: Advanced Tile Loader + camera
Posted: Sat Sep 29, 2012 10:05 am
by Roland_Yonaba
Well, a bit of searching can bring you answers.
Did you go through the examples of use for AdvTiled Loader ?
See
Desert_Example, watch out global.tx/global.ty variables, and the push(), translate() and pop() methods.
This tutorial on cameras should help, too.
Re: Advanced Tile Loader + camera
Posted: Sat Sep 29, 2012 11:07 am
by luaz
Roland_Yonaba wrote:Well, a bit of searching can bring you answers.
Did you go through the examples of use for AdvTiled Loader ?
See
Desert_Example, watch out global.tx/global.ty variables, and the push(), translate() and pop() methods.
This tutorial on cameras should help, too.
I did. I can scroll the camera with set keys, but I want it to scroll with the player. That's the point of this thread - I cannot tie them together, the player AND the tilemap.
Re: Advanced Tile Loader + camera
Posted: Sat Sep 29, 2012 5:03 pm
by SudoCode
Update the camera position each frame to playerX and playerY.
Re: Advanced Tile Loader + camera
Posted: Sat Sep 29, 2012 5:41 pm
by dreadkillz
There are camera libs that you can check out from searching. If you don't want to use them, check their codes to get an idea of how it works.
Re: Advanced Tile Loader + camera
Posted: Sat Sep 29, 2012 5:54 pm
by luaz
I got it working... But I have no idea why it works, it seems as if there's something either missing or too much.
Well, if something won't work, I'll ask for help with my code then. For now, I'm okay with this.