Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

CheckCollision Class Reference

CheckCollision Class Reference

CheckCollision class. More...

#include <CheckCollision.h>

Inherits Position.

Inherited by Alien, and Spaceship.

Public Member Functions

bool check_collision (Weapons bullet)
 Checks if bullet collides with a sprite.
Vector2D get_pos ()
 Gets the xy position of the sprite.

Protected Attributes

int sprite_x_length
 Length of sprite in x direction.
int sprite_y_length
 Length of sprite in y direction.
int position_x_
 X position on lcd.
int position_y_
 Y position on lcd.
bool direction_
 Movement direction.

Detailed Description

CheckCollision class.

Check Collision perant class

Author:
Benjamin Evans, University of Leeds
Date:
May 2020

Definition at line 14 of file CheckCollision.h.


Member Function Documentation

bool check_collision ( Weapons  bullet )

Checks if bullet collides with a sprite.

Parameters:
bulletWeapons object

Definition at line 3 of file CheckCollision.cpp.

Vector2D get_pos (  ) [inherited]

Gets the xy position of the sprite.

Returns:
position_x_
position_x_

Definition at line 3 of file Position.cpp.


Field Documentation

bool direction_ [protected, inherited]

Movement direction.

Note:
true = East, false = West

Definition at line 35 of file Position.h.

int position_x_ [protected, inherited]

X position on lcd.

Definition at line 27 of file Position.h.

int position_y_ [protected, inherited]

Y position on lcd.

Definition at line 30 of file Position.h.

int sprite_x_length [protected]

Length of sprite in x direction.

Definition at line 27 of file CheckCollision.h.

int sprite_y_length [protected]

Length of sprite in y direction.

Definition at line 30 of file CheckCollision.h.