Untitled SFML Games
I've been working with SFML in my spare time to practice my C++ and Object-Oriented programming skills, along with learning new concepts and patterns. They aren't much to look at because I had few art assets to work with, though the source code for all is viewable here.
The first game, made in my spare time during my second year of university, was a top down ship combat game which featured momentum-based movement and axis-aligned bounding boxes for collisions.
The next SFML game I produced, this time during my final year of undergrad was a 2D Side scroller game featuring multiple player characters the player can swap between, jumping physics and collisions, objects the player can interact with and a full-fledged screen system for changing scenes.
I mainly created this so I could have attempt to implement the command pattern into a game, and decided that a good way to show off its use would be to have multiple characters to swap between.
After I graduated I was going to continue working on my side Scroller game but looking through my repository I decided I could just do better. So I started again from scratch, this time focussing on perfecting the movement system and adding animations. This iteration has less features than the previous one but is far better written (see below for code dissections).
I decided to make the player class inherit from sf::Sprite (which in turn inherits from sf::Drawable and sf::Transformable) allowing me to draw any player objects without the need for a sf::Sprite class member, this also inherently gives the player a transform and uitilities to manipulate the transform (e.g. player.move()). I also created a state enum which determies which animation should be playing as well as restricting certain actions while in certain states:
I also experimented with a utility namespace named 'helpers' which contained static methods and variables which would need to be accessible from various classes such as the update rate and minimum ground height along with functions to determine whether any input was being detected from any key relevant to the game (as opposed to checking every possible input source for input):