SFML Game

Full Code

This is a simple implementation of an RPG game using gamestates classes that inherit from an orignial game state. Each gamestate has its own unique qualities that allow for the game to have varying states while also keeping the implementation of new states simple.

In order to create the game, the first step was to create a base state class from which all other states would inherit. The base class initialize a the rendew window, the supported keys, the keybinds, a bool for the quit state, and the mouse position and qualities. The state would hold several virtual classes that would need to be implemented by each base state, that would perform various functions such as checking if the endState has been met, rendereing objects, and getting mouse position.

State Class

So far I have implemented two states within the game, the main menu state, and the game state. In the mainmenu state, there are two buttons, one that will quit the game, and another that will push the game state onto the stack of states. The buttons are implemented by creating a rectengle in the window and listening for if the mouse is within that rectangle, and a mouse click occurs.

Main Menu State

The next state is the game state. The game state contains a rectangle that moves according to user input using the w,a,s, and d keys. The key inputs can be change by editing a txt file associated with each state. In order to capture movement of the when button is pressed, that object associated is moved and then the new windows is rendered to the screen.

Capture Movement Game State

This project is still in prgress, but the next stemps are to add more depth to both the game_state and main_menu states and begin to add objects with more properties like the player and items.