Don't Starve style camera?
Posted: Sun Apr 13, 2014 5:34 pm
Hey folks,
I'm trying to imitate the Don't Starve camera. For those who haven't played it, Don't Starve is a 2d game with a camera perspective very slightly tilted such that entities on the objects of the screen appear slightly larger than objects at the top of the screen. Objects are still 2d orthogonal sprites though, that is, they appear flat without any tilt.
The main thing I want to mimic is that parallax scrolling effect that each object exhibits when you walk left and right. To illustrate, I've taken some screenshots. I've placed three twigs alone the same y position:
Now I move to the right:
Note that twig towards the bottom has moved further to the left than the twig towards the top.
Here is a composite image:
What's the cleanest way to implement something like this? Let's assume I have a single atlas image that I will be rendering as a sprite batch. In addition to doing a global love.graphics.translate() to move the camera with the player, do I have to manually calculate x offsets for each sprite proportional to their y position? Or is there a cleaner way to do it?
I'm trying to imitate the Don't Starve camera. For those who haven't played it, Don't Starve is a 2d game with a camera perspective very slightly tilted such that entities on the objects of the screen appear slightly larger than objects at the top of the screen. Objects are still 2d orthogonal sprites though, that is, they appear flat without any tilt.
The main thing I want to mimic is that parallax scrolling effect that each object exhibits when you walk left and right. To illustrate, I've taken some screenshots. I've placed three twigs alone the same y position:
Now I move to the right:
Note that twig towards the bottom has moved further to the left than the twig towards the top.
Here is a composite image:
What's the cleanest way to implement something like this? Let's assume I have a single atlas image that I will be rendering as a sprite batch. In addition to doing a global love.graphics.translate() to move the camera with the player, do I have to manually calculate x offsets for each sprite proportional to their y position? Or is there a cleaner way to do it?