Game Overview
Shotgun is a 2D shooter, made in the first year at the University of Bolton as part of the Introduction To Games Programming module. Over the course of the month, it was created by a team of 2 using SDL and C++.My Roles
During development, I was assigned roles in order to complete the game to a good standard. The roles which I was assigned toWhat went well?
What can be improved?
Health and Armour Bar Update:
This code sample deals with the health and armour bar. When the player is hit, one will decrease.void GhostHunter::updateHealth(character &player, int healthChange) { if (player.getArmor() <= 0) //if player has no armor { player.setHealth(player.getHealth() - healthChange); //decrease health by healthChange player.m_healthBar.frames[0]->w = player.m_healthBar.frames[0]->w - (healthChange / 2); } else { player.setArmor(player.getArmor() - healthChange); //otherwise decrease armor by healthChange player.m_armorBar.frames[0]->w = player.m_armorBar.frames[0]->w - (healthChange); } }
Mouse Button Click:
A code sample that deals with button clicks on UI buttons. Checks to see if the mouse is inside the button and then checks for a click.if (cursor.bb_collision(resumeBtn) && getMouseClicked() == true && getPaused() == true) { setPaused(false); //resume game pauseBg.set_visibility(false); //make pause screen invisible resumeBtn.set_visibility(false); restartBtn.set_visibility(false); quitBtnP.set_visibility(false); pauseTimeEnd = SDL_GetTicks(); difference += (pauseTimeEnd - pauseTime); }