Nemesis game, friendly

Embed: (wiki syntax)

« Back to documentation index

Friendly Class Reference

Friendly Class Reference

Friendly Class. More...

#include <Friendly.h>

Public Member Functions

 Friendly ()
 Constructor and destructor:
void init ()
 Initialize Friendly.
void draw (N5110 &lcd)
 Draw Friendly.
void update_basic (Direction d, float mag)
 Update Friendly (basic)
void update_diagonal (Direction d, float mag)
 Update Friendly (diagonal)
void check_pos ()
 Check Friendly Position.
Vector2D get_pos ()
 Get Friendly Position.

Detailed Description

Friendly Class.

Used for controlling the friendly ship in the Nemesis game. Includes drawing, checking, and updating functions. Incorporates N5110.h and Gamepad.h files by Craig A. Evans.

Revision 1.0

Author:
Musallam M. M. Bseiso
Date:
3rd May 2017

Definition at line 19 of file Friendly.h.


Constructor & Destructor Documentation

Friendly (  )

Constructor and destructor:

Definition at line 3 of file Friendly.cpp.


Member Function Documentation

void check_pos (  )

Check Friendly Position.

Ensures the friendly ship does not go out of bounds (off screen or into the stats bar) by limiting its x and y positions.

Definition at line 76 of file Friendly.cpp.

void draw ( N5110 &  lcd )

Draw Friendly.

Draws the friendly ship onto the LCD, in accordance with the parameters initialized in the "init" method.

Parameters:
N5110- nokia LCD library
lcd- pointer to nokia LCD library

Definition at line 23 of file Friendly.cpp.

Vector2D get_pos (  )

Get Friendly Position.

Obtains the position (x and y coordinates) of the friendly ship at any given time, into a two-dimensional vector.

Returns:
p - the Vector2D of the parameters

Definition at line 98 of file Friendly.cpp.

void init (  )

Initialize Friendly.

Initializes friendly ship x & y positions.

Definition at line 14 of file Friendly.cpp.

void update_basic ( Direction  d,
float  mag 
)

Update Friendly (basic)

Updates the friendly ship's x and y position. X and y positions are altered by adding/subtracting speeds, which depend on the direction (d) of the analog stick. The speed is defined as the magnitude of the movement of the analog stick multiplied by an arbitrary number (set as 4). This method only deals with the basic horizontal and vertical movements of the friendly ship (North, South, West, East).

Parameters:
d- direction of analog stick
mag- magnitude of movement of analog stick

Definition at line 36 of file Friendly.cpp.

void update_diagonal ( Direction  d,
float  mag 
)

Update Friendly (diagonal)

Updates the friendly ship's x and y position. X and y positions are altered by adding/subtracting speeds, which depend on the direction (d) of the analog stick. The speed is defined as the magnitude of the movement of the analog stick multiplied by an arbitrary number (set as 4). This method only deals with the diagonal movements of the friendly ship (Northwest, Northeast, Southwest, Southeast).

Parameters:
d- direction of analog stick
mag- magnitude of movement of analog stick

Definition at line 54 of file Friendly.cpp.