Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Ship/Ship.h
- Committer:
- josh_ohara
- Date:
- 2020-05-18
- Revision:
- 35:517b56b010df
- Parent:
- 27:eb755a345b1f
- Child:
- 36:78efa0e7bd31
File content as of revision 35:517b56b010df:
#ifndef SHIP_H
#define SHIP_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "BulletS.h"
/** Ship Class
@author Joshua Ohara, el18jkeo, 201291390
@brief Controls the ship
@date May 2020
*/
class Ship
{
public:
Ship();
~Ship();
void init(int height, int width); //initialises ship object, sets private variables
void render(N5110 &lcd); //draws ship if alive
void update(Direction d, float mag, Gamepad &pad, N5110 &lcd, int counter, int powerup); //updates the position and shooting of the ship
//accessors and mutators
void set_life(bool life); //sets the life of the ship
bool get_life(); //returns the life of the ship
void set_bullet_hit(int i, bool hit); //sets the life of a given ship bullet (hit if a collsion occurs)
Vector2D get_position(); //returns the position of the ship for collision check
vector<ShipBullet> get_bullet_vector(); //returns the ship bullet vector for collsion check
private:
int _height; //height of the ship main rectangle
int _width; //width of the ship main rectangle
int _x; //x posittion of ship
int _y; //y position of the ship
int _speed; //speed of the ship in x direction
bool _life; //whether the ship is alive or not
BulletS _ship_bullet_vector; //object to create ship bullet vector
};
#endif