A hectic week

This week has been very hectic because of the incoming alpha milestone and for some reason everything always starts to go wrong when you are close to a critical point. but on to this weeks artifact.

I have mostly worked on the first enemy of the game which is a swordfish. This enemy will swim across the screen until it is in line with the player and  when that happens it starts to charge and will not stop until it is outside of the screen where it de-spawns.

This behavior is done by having two different states, one for when the fish is just idling and one for charging. The states will have two different animated textures to indicate which state it is in. In the Idle state the fish moves forwards and  up and down until it is within the same y coordinates as the player. When that happens the state changes to a state where it starts charging. The charging mechanic is to give the enemy a bit of variety and to make the game a bit more about avoiding the enemies which is one of our goals.

During my development of this artifact I found one big bug that stopped development for some time. The texture was not rendering and I had no idea why since I used the same animated texture class for the player and everything worked. What i had to do was setting the textures rectangle when I was  creating a frame and not when the frame was changed. The answer was not as clear as I would have hoped and I am still a bit confused to why this fix worked but I should not complain since it is working.

Me having problems with the graphical part of SFML seems to be a theme judging by my last post but I hope I have it under control now. If there is one tip that I would give anyone starting with a new interface like SFML or anything else for that matter: Read the documentation ASAP! I have come to realize that SFML had a lot of functionality that I did not know about which made me create things that already existed and I will probably read a bit more of it during this weekend so that I don not have to make more big mistakes that will put a bump into development times.

Swordfish Aligns + Charges sprites

About Philip Olsson

2015 Programming