Git Product home page Git Product logo

c-nd-capstone-space-game's Introduction

CPPND: Capstone Space Game

The Capstone project is inspired in 2D shoot 'em up. This is a simple version, where player needs to destroy the enemy before reaches the other side. Player has five opportunity before loose the game.

Here how you control your spaceship,

  • Arrows key to move spaceship.
  • Spacebar to fire bullet.

Finally, this project was following the principles we have learned throughout this Nanodegree Program. Still a lot of opportunity for code refactoring and add more C++ features.

Dependencies for Running Locally

Basic Build Instructions

  1. Install dependencies apt-get install -y libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev (Ubuntu)
  2. Clone this repo.
  3. Make a build directory in the top level directory: mkdir build && cd build
  4. Compile: cmake .. && make
  5. Run it: ./SpaceGame.

Top-level directory layout

.
├── src                     # Source files.
├── res                     # Game resources like sounds, fonts, sprites, etc.
├── cmake                   # Tools.
├── CMakeLists.txt
└── README.md

Project's Class Structure

src                     # Sources files. 
├── audio.h             # Constructor to initiate a singleton to manage audio resources.
├── audio.cpp           # APIs to access audio resources.
├── bullet.h            # Bullet object definition and attach sprite to the object.
├── bullet.cpp          # Method to track the object's physics (update)
├── controller.h        # Declaration controller's user input.
├── controller.cpp      # Monitoring user inputs.
├── enemy.h             # Enemy object definition and attach sprite to the object.
├── enemy.cpp           # Method to track the object's physics (update)
├── entity.h            # Basic object definition. Any game object will inherited this class.
├── entity.cpp          # Basic object methods.
├── game.h              # Game object initiation.
├── game.cpp            # Game Loop run.
├── graphics.h          # Constructor to initiate a singleton to manage images(sprite) resources.
├── graphics.cpp        # APIs to access images resources.
├── main.cpp            # The main to compile the project.
├── player.h            # Player object definition and attach sprite to the object.
├── player.cpp          # Method to track the object's physics (update)
├── renderer.h          # Helper definition to draw the screen.
├── renderer.cpp        # Helper methods to draw the screen.

Project Specification

README (All Rubric Points REQUIRED)

Done Criteria Meets Specifications
A README with instructions is included with the project The README is included with the project and has instructions for building/running the project.

If any additional libraries are needed to run the project, these are indicated with cross-platform installation instructions.

You can submit your writeup as markdown or pdf.
The README indicates which project is chosen. The README describes the project you have built.

The README also indicates the file and class structure, along with the expected behavior or output of the program.
The README includes information about each rubric point addressed. The README indicates which rubric points are addressed. The README also indicates where in the code (i.e. files and line numbers) that the rubric points are addressed.

Compiling and Testing (All Rubric Points REQUIRED)

Done Criteria Meets Specifications
The submission must compile and run. The project code must compile and run without errors. We strongly recommend using cmake and make, as provided in the starter repos. If you choose another build system, the code must compile on any reviewer platform.

Loops, Functions, I/O

Done Criteria Meets Specifications
The project demonstrates an understanding of C++ functions and control structures. A variety of control structures are used in the project.

The project code is clearly organized into functions.
The project reads data from a file and process the data, or the program writes data to a file. The project reads data from an external file or writes data to a file as part of the necessary operation of the program.
The project accepts user input and processes the input. The project accepts input from a user as part of the necessary operation of the program.

Object Oriented Programming

Done Criteria Meets Specifications
The project uses Object Oriented Programming techniques. The project code is organized into classes with class attributes to hold the data, and class methods to perform tasks.
Classes use appropriate access specifiers for class members. All class data members are explicitly specified as public, protected, or private.
Class constructors utilize member initialization lists. All class members that are set to argument values are initialized through member initialization lists.
Classes abstract implementation details from their interfaces. All class member functions document their effects, either through function names, comments, or formal documentation. Member functions do not change program state in undocumented ways.
Classes encapsulate behavior. Appropriate data and functions are grouped into classes. Member data that is subject to an invariant is hidden from the user. State is accessed via member functions.
Classes follow an appropriate inheritance hierarchy. Inheritance hierarchies are logical. Composition is used instead of inheritance when appropriate. Abstract classes are composed of pure virtual functions. Override functions are specified.
Overloaded functions allow the same function to operate on different parameters. One function is overloaded with different signatures for the same function name.
Derived class functions override virtual base class functions. One member function in an inherited class overrides a virtual base class member function.
Templates generalize functions in the project. One function is declared with a template that allows it to accept a generic parameter.

Memory Management

Done Criteria Meets Specifications
The project makes use of references in function declarations. At least two variables are defined as references, or two functions use pass-by-reference in the project code.
The project uses destructors appropriately. At least one class that uses unmanaged dynamically allocated memory, along with any class that otherwise needs to modify state upon the termination of an object, uses a destructor.
The project uses scope / Resource Acquisition Is Initialization (RAII) where appropriate. The project follows the Resource Acquisition Is Initialization pattern where appropriate, by allocating objects at compile-time, initializing objects when they are declared, and utilizing scope to ensure their automatic destruction.
The project follows the Rule of 5. For all classes, if any one of the copy constructor, copy assignment operator, move constructor, move assignment operator, and destructor are defined, then all of these functions are defined.
The project uses move semantics to move data, instead of copying it, where possible. For classes with move constructors, the project returns objects of that class by value, and relies on the move constructor, instead of copying the object.
The project uses smart pointers instead of raw pointers. The project uses at least one smart pointer: unique_ptr, shared_ptr, or weak_ptr. The project does not use raw pointers.

Concurrency

Done Criteria Meets Specifications
The project uses multi-threading. The project uses multiple threads in the execution.
A promise and future is used in the project. A promise and future is used to pass data from a worker thread to a parent thread in the project code.
A mutex or lock is used in the project. A mutex or lock (e.g. std::lock_guard or std::unique_lock) is used to protect data that is shared across multiple threads in the project code.
A condition variable is used in the project. A std::condition_variable is used in the project code to synchronize thread execution.

c-nd-capstone-space-game's People

Contributors

vanshvarshney avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.