Animated Water Tiles Started
This week the first thing I worked on was getting the animated water tile animations setup. I created a universal animated tile class that I am using to handle all the animated tiles. So, all my water tiles are setup as tiles of the animated tile class. Basically, my animated tile class is setup to take in a sprite sheet and separate each sprite into different frames of the overall animation. Each animated strip is made up of 8 sprites. By using the class with different sprite sheets, I can now add all the different edge water tiles into the game using the same class.
Reconfigured Tile Classes:
While figuring out how to create the animated tile class I changed the way I was making my tiles. I originally had a class for each one, mountain, water, grass, etc. Now I created a class called basic tile that handles all the standard tiles. I also set a Boolean variable that is set upon using the class that determines if the tile should be solid (can collide with it). This change helped simplify my code and remove a lot of unnecessary classes.
Animated Tile Error:
I did run into a crazy bug while working out the animated tile class. As I would move around with the player the more water tiles that would show on the screen the faster the animation would play. After a lot of debugging I was able to figure out that I was adding the delta time variable to the state time to many times. The variable was continually adding to the state time 60 times for each tile visible each loop of the game. So, I just needed to move where I was adding the delta time so it would only change once every game loop. That fixed the crazy looking bug where the animation would speed up so fast it would just look like glitches.

The last work I did for the week was getting the dark water also animating. For now, I decided not to calculate the edge between the dark water and the regular water. So, the tiles just have a squared edge. But the animation is the same, and the only difference is that the water is slightly darker.
Screen Resizing Error:
Just today I was also able to figure out a rendering issue when the screen size would change. The error would cause the screen edges to show the edge of the screen being removed from rendering because it should have been off the screen, but it was not. I was using the wrong size for the screen resolution and it was causing the screen edges to appear smaller than they should with bars on the sides. I still need to figure out a way to limit the screen changes to stay in the same aspect ratio, so the sprites do not distort depending on the screen size. But that will have to wait till a later time.
Next Pieces of the Project:
The next parts I would like to start working on are more animation for the player. Attack animations being the first I would like to work on. The problem is I need to figure out how I plan to handle them, and I also need to create the sprites. I also want to start working on a user interface and inventory system.
Change List:
Added: water edge and corner sprites
Created: water tile animation sheets for each edge animation and regular water.
Created: dark water tile animation sheet for the dark water.
Added: animated tile class to handle all different animated tiles.
Added: basic tile class to replace all my standard tiles with one tile class.
Removed: separate tile classes (water, mountain, grass, sand, etc.).
Fixed Bug: water animations speeding up depending on how many were on the screen. (updating state time in the wrong location)
Fixed Bug: screen size when getting smaller would not render properly. (I was using the wrong numbers to calculate the screen size when rendering the map tiles)
Animated Water Tiles Started Read More »