Backing up

This week has been a bit slow for me for a reason that I should have discovered earlier. Allergies. Spring is in the air and with it comes pollen which in my case means a bleeding nose and cloudy thoughts. But enough about biological issues and on to the reason for this blog post.

The biggest artifact this week is that I took it upon myself to make the system to do parallax scrolling. This consists of a BackgroundManager and BackgroundElements. The manager is responsible for creating and drawing the different elements on the background. The BackgroundElements are objects like cliffs, seashells and starfish that will be on different layers with different speed and will therefore look like they have a kind of depth and makes the background look a bit more alive.

The manager has a map containing pairs of file paths to an image and SFMLs sf::Intrects. When creating an object in the background the manager randomly chooses one of these pairs and will pass them into a new background element. Each object will be stored in a vector that holds all objects and when the one of them leaves the screen it will be deleted. The elements are just simple objects that move to the left and when they are created they have a different scale and speed depending on which layer it is on to create the illusion of depth.

My future plans for this artifact is to be able to do different environments with different kinds of backgrounds since one of our goals for the game is to start out in a normal seabed setting and then move on to a harder cave setting and creating a system that can do this smoothly is something I think would be really great to have and it would also open up the ways to creating more settings and environments. Sadly we probably will not have the time to create more areas but its good to have as an experience for the future.

This work should have taken a lot less time than it has but that is partly because of my allergies which has been making this entire week a lot more confusing than it should have been. The other part of why this took longer than expected was because I were over complicating things by trying to theories how things should be done instead of actually doing it.

But now on to a new and hope fully much clearer week!Backgroundtemp.png

 

About Philip Olsson

2015 Programming