Day 2 of development for The Well has just finished. I didn’t get as much done today as I would have liked, and am falling behind. If I really want to finish in these 5 days, I am going to have to really focus on it and not get too caught up prematurely optimising things or getting too ambitious. With that said, there was some good progress today in terms of art and coding.
Coding wise, I have set up some world physics for the player. Every game tick (every time the physics up dates), I apply a set acceleration downward on all non fixed physics objects to represent gravity. At the moment, this is just the player but it will automatically be applied to any other objects I put in the world such as mobs or a box. When the player presses up, it gives a larger acceleration in the opposite direction for a fixed amount of time before gravity causes it to slow down and fall again. The difficulty I had was trying to make sure the player can only go upwards for a certain amount of time, and then make sure that they are touching the ground before they could jump again. The good thing about having this system set up was that it made it easier for me to set when what animations need to be played. Since I had all this information of when the player was touching the ground, when he was jumping and when he was falling, I then was able to easily tell it to play the desired animation.
The animation system that I’ve set up took me awhile to figure out, but I managed to get it to work in the end. The way I set it up in the end is that each entity sprite has a list of animations, and each of these animations are made up of animation frames and some other data. Each frame is given a duration to be played, and each animation has a timer that counts how long the animation has gone on for. When the duration of a frame runs out, it then tells the sprite to display the image of the next frame. I had some other variables such as whether the animation loops, or whether it ends with a fixed image. This was used for things like the falling animation where the character raises his arms, and they stay raised until he hits the ground.
The progress I made with art today was that I managed to get some animations for the player drawn. Each animation is just made up of a few different images (about 2-4), and so today I managed to draw the animations for running, jumping and falling. I am getting more used to doing pixel art, so hopefully by the time I get to doing the textures I would be able to do them quickly as they should be much easier than animations.
Challenges I had today was all the bugs I kept getting every time I tried to add something new such as the animation system or the physics. I think I really need to think clearly about what I want to implement and how I am going to do it before just writing a bunch of code that I later have to go through, fix and clean up. At least I managed to do better today on not prematurely optimising code as the systems I had to make today were pretty specific to this type of game.
Although this project is small, making all these little bits of it are making me see the potential of what kind of game I could accomplish if I wanted to designate the time. After I finish this project, I may try to use what I’ve learnt to implement a more complex version of it with better physics and more modular code.