Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

CheckAlienCollision Class Reference

CheckAlienCollision class. More...

#include <CheckAlienCollision.h>

Inherits Position.

Inherited by People, and Spaceship.

Public Member Functions

bool check_alien_collision (Alien alien)
 Checks if alien collides with a sprite.
Vector2D get_pos ()
 Gets the xy position of the sprite.

Protected Member Functions

bool check_top_right (Alien alien, Vector2D alien_pos)
 Checks if alien collides with top right of sprite and return flag.
bool check_top_left (Alien alien, Vector2D alien_pos)
 Checks if alien collides with top left of sprite and return flag.
bool check_bottom_right (Alien alien, Vector2D alien_pos)
 Checks if alien collides with bottom right sprite and return flag.
bool check_bottom_left (Alien alien, Vector2D alien_pos)
 Checks if alien collides with bottom left sprite and return flag.

Protected Attributes

int sprite_x_length
 Length of sprite in x direction.
int sprite_y_length
 Length of sprite in y direction.
bool alien_collision_flag
 Flag if there is is a alien collision.
bool alien_track
 Flag if the alien that colided is tracking.
int position_x_
 X position on lcd.
int position_y_
 Y position on lcd.
bool direction_
 Movement direction.

Detailed Description

CheckAlienCollision class.

Check Alien Collision parent class

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

Definition at line 14 of file CheckAlienCollision.h.


Member Function Documentation

bool check_alien_collision ( Alien  alien )

Checks if alien collides with a sprite.

Parameters:
alienAlien object

Definition at line 3 of file CheckAlienCollision.cpp.

bool check_bottom_left ( Alien  alien,
Vector2D  alien_pos 
) [protected]

Checks if alien collides with bottom left sprite and return flag.

Parameters:
alienAlien object
alien_posvector2D of alien xy position
Returns:
check_collision

check collision flag

Definition at line 51 of file CheckAlienCollision.cpp.

bool check_bottom_right ( Alien  alien,
Vector2D  alien_pos 
) [protected]

Checks if alien collides with bottom right sprite and return flag.

Parameters:
alienAlien object
alien_posvector2D of alien xy position
Returns:
check_collision

check collision flag

Definition at line 66 of file CheckAlienCollision.cpp.

bool check_top_left ( Alien  alien,
Vector2D  alien_pos 
) [protected]

Checks if alien collides with top left of sprite and return flag.

Parameters:
alienAlien object
alien_posvector2D of alien xy position
Returns:
check_collision

check collision flag

Definition at line 21 of file CheckAlienCollision.cpp.

bool check_top_right ( Alien  alien,
Vector2D  alien_pos 
) [protected]

Checks if alien collides with top right of sprite and return flag.

Parameters:
alienAlien object
alien_posvector2D of alien xy position
Returns:
check_collision

check collision flag

Definition at line 36 of file CheckAlienCollision.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 alien_collision_flag [protected]

Flag if there is is a alien collision.

Definition at line 63 of file CheckAlienCollision.h.

bool alien_track [protected]

Flag if the alien that colided is tracking.

Definition at line 66 of file CheckAlienCollision.h.

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 57 of file CheckAlienCollision.h.

int sprite_y_length [protected]

Length of sprite in y direction.

Definition at line 60 of file CheckAlienCollision.h.