Level Transition

Our game is in the final stages of being complete, so at the moment we are focusing on visual polish, fixing any bugs we can find and improving the art assets. As far as visual polish goes from a programming perspective, this week I was tasked with doing the level transition for the game. Currently it operates on a never endless mode where after all the waves have passed, the game restarts with more difficult enemies and will continue to do so to a point where it becomes so challenging that the player cannot survive.

Youtube Video

The video is from earlier in the week when I was showing what I had so far to my team. Since then I’ve tweaked it here and there to make it look just better in general, but here is a rundown of what I’ve done so far for it and what I plan to adjust in the upcoming days.

To start with, there are currently 2 overall scripts that are in effect, both of which are fairly small and simple. All of the background elements such as the plants and grass are children objects of the overall “Background Parent”. This parent has a script which, upon being triggered to begin the transition, goes through all of it’s children which contain the second script and feeds them a Delta value which is the zoom.

The second script, which all the children have, is a modified script from weeks ago which is allows for a Parallax effect. In combination with that, when they are fed this “zoom” delta from the parent, their position and scale is increased, giving the impression that the player is going towards them. When they are close enough, they start to fade away and once they are completely out of view, they are repositioned at the back of the scene and fade back in. Their zoom value is also reset to the minimum allowing them to fade back in and give the sense that they are at a distance. Originally I had them remove themselves when they get close enough and spawn a clone at the far back, but I was worried what would happened when having this sequence play for a long time. Every time I spawned a clone, it kept doubling the name over so it ended up looking like “Object(Clone)(Clone)(Clone)”, so I figure I’d take the safe route.

To further give the notion of distance, I also made it so that the less their zoom value is, the darker they are. However an issue as come up which I have yet to figure out how to solve, since I believe it is Unity related and I haven’t found a solution online. For some bizzare reason, sprite modification to the Sprite Renderer stops working when it has an Animator attached. At the moment, since I am changing all the colors of the object manually, depending on their zoom, they refuse to change color when I attach an Animator to them, except the Alpha channel. I think there is some conflict with the Animator allowing for each frame to have a custom color. If only I had some way of accessing the color for each frame, or to have the frames read the color off of a script. If there is a way, I have yet to find it, which is going to be quite troublesome since I was hoping to use animations to make the background feel more alive.

 

One thought on “Level Transition

  1. It’s good that you began by going through what the state of the project was before going into the work you did during the week so that the reader gets a perspective of what needed to be done. I think you could go into more detail of what the zoom delta does. It “increases position and scale,” could mean a linear change, or some sort of curve to to that you thought made it look better. It was very helpful that you explained why certain decisions you made were made, such as that you changed the script from cloning, to change position and scale of objects that are faded out, most people don’t explain the reasoning behind their decision. It was also good that you went over things you couldn’t fix or figure out as well, so it is apparent what the problems of your approach are. Overall it was a very useful blog post, the video helped a lot.

    Like

Leave a comment