Install homebrew first.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
Install cmake
brew install cmake
Install sdl2_image.
brew install sdl2_image
- cmake >= 3.7
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- SDL2 >= 2.0
- All installation instructions can be found here
- Note that for Linux, an
apt
orapt-get
installation is preferred to building from source.
- gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make sure you have libraries SDL2 and SDL2_Image installed.
- Make a build directory in the top level directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./MissleCommand
.
- The emeny is firing missles at your cities. You must fire missles back to destroy them.
- Click with the mouse to fire defensive missles at the incoming missles
- Missles will fire from the surface and explode at the point you clicked. If you can get the incoming missle into the explosion, it will destroy the incoming missle.
- 25 points for every missle you destroy
- In the long run, the game will have levels. Bonus points will be awarded at the end of every level, for each city still standing and each missle not used.
- Protect the cities. When your 6 cities are gone, the game is over.
- Subdirectory 'src' contains all .cpp and .h files.
- game.cpp runs the game cycle. It's Run method:
-
- takes User input, (controller.cpp)
-
- updates game elements, (game.cpp Update method calls Update on game objects)
-
- cleans up destroyed elements (game.cpp has two cleanup methods to wipe out destroyed objects)
-
- then renders the resulting object to the game screen (render.cpp draws objects)
- The submission must compile and run.
- Functions and controll structures are there.
- No External files read.
- User input is taken from the mouse pointer to aim missles.
-
- src/control.cpp - line 7 'HandleInput' reads mouse clicks
-
All class data members are explicitly specified as public, protected, or private.
-
- see missle.h, all lines
-
Classes use accessor functions
-
Class constructors use Member initialization lists
-
- game.cpp, in constructor at lines 8-10
-
- renderer.cpp, in constructor at lines 8-11
-
- controler.cpp, lines 13-14
-
Details abstracted in classes
-
- silo.cpp city.cpp missle.cpp
-
Encapsalation
-
- silo.cpp city.cpp missle.cpp
-
One member function in an inherited class overrides a virtual base class member function.
-
- see missle.h base class with virtual function 'Update' at line 25.
-
-
- offense_missle.h / .cpp at line 6 and
-
-
-
- defense_missle.h / .cpp at line 10, override 'Update' virtual function.
-
- Refernces are passed, specially vectors of shared_ptrs.
-
- game.h Game::Run, line 55
- Uses shared_ptr for Vectors of silo.cpp, city.cpp, offense_missle.cpp, and defense_missle.cpp
-
- game.h lines 41-45
This is a starter repo for the Capstone project in the Udacity C++ Nanodegree Program. The code for this repo was inspired by this excellent StackOverflow post and set of responses.