Ben Evans University Second Year Project. Game Called Defender.
Alien Class Reference
#include <Alien.h>
Inherits RandomMovement, and CheckCollision.
Public Member Functions | |
| Alien () | |
| Constructor. | |
| ~Alien () | |
| Destructor. | |
| void | init (Gamepad &pad, int position_x_start, int position_y_start) |
| Initialises Alien. | |
| void | draw_alien (N5110 &lcd, Vector2D spaceship_pos, Direction d_, int map_length_, int position_x_map_, bool alien_collision) |
| Draws the alien. | |
| int | get_alien_fire_counter () |
| Gets the counter for alien time to fire. | |
| void | set_alien_x_pos (int position_x) |
| Sets the position_x_ of alien. | |
| void | set_collision_people_element (int people_element) |
| Sets the collision_people_element number. | |
| int | get_collision_people_element () |
| Gets the collision_people_element number. | |
| void | set_track_flag (bool track_flag) |
| Sets alien track_flag. | |
| bool | get_track_flag () |
| Gets alien track_flag. | |
| Vector2D | get_pos () |
| Gets the xy position of the sprite. | |
| bool | check_collision (Weapons bullet) |
| Checks if bullet collides with a sprite. | |
Protected Member Functions | |
| void | set_sprite_direction (int x_change, int y_change) |
| Changes the x and y positions of the sprite object depending on the movement direction. | |
| void | set_random_move () |
| Generates the random move direction and length for the sprite. | |
| void | move_direction () |
| Gets the movement direction of the sprite. | |
| int | calc_sprite_movement (Direction d_) |
| Calculates the sprite movement depending on spaceship positions and joystick input. | |
Protected Attributes | |
| int | random_move_counter_ |
| Sprite random move counter. | |
| int | random_direction_ |
| Random direction variable. | |
| int | position_x_ |
| X position on lcd. | |
| int | position_y_ |
| Y position on lcd. | |
| bool | direction_ |
| Movement direction. | |
| int | sprite_x_length |
| Length of sprite in x direction. | |
| int | sprite_y_length |
| Length of sprite in y direction. | |
Detailed Description
Alien class.
Draws and moves aliens
- Date:
- May 2020
Definition at line 15 of file Alien.h.
Constructor & Destructor Documentation
Member Function Documentation
| int calc_sprite_movement | ( | Direction | d_ ) | [protected, inherited] |
Calculates the sprite movement depending on spaceship positions and joystick input.
- Parameters:
-
d_ : Direction object of joystick
- Returns:
- integer
move alien value for alien draw function
Definition at line 31 of file RandomMovement.cpp.
| bool check_collision | ( | Weapons | bullet ) | [inherited] |
Checks if bullet collides with a sprite.
- Parameters:
-
bullet Weapons object
Definition at line 3 of file CheckCollision.cpp.
| int get_alien_fire_counter | ( | ) |
| int get_collision_people_element | ( | ) |
| Vector2D get_pos | ( | ) | [inherited] |
Gets the xy position of the sprite.
- Returns:
- position_x_
- position_x_
Definition at line 3 of file Position.cpp.
| bool get_track_flag | ( | ) |
| void init | ( | Gamepad & | pad, |
| int | position_x_start, | ||
| int | position_y_start | ||
| ) |
| void move_direction | ( | ) | [protected, inherited] |
Gets the movement direction of the sprite.
Definition at line 3 of file RandomMovement.cpp.
| void set_alien_x_pos | ( | int | position_x ) |
| void set_collision_people_element | ( | int | people_element ) |
| void set_random_move | ( | ) | [protected, inherited] |
Generates the random move direction and length for the sprite.
Definition at line 20 of file RandomMovement.cpp.
| void set_sprite_direction | ( | int | x_change, |
| int | y_change | ||
| ) | [protected, inherited] |
Changes the x and y positions of the sprite object depending on the movement direction.
- Parameters:
-
x_change number to change sprite x position by y_change number to change sprite y position by
Definition at line 15 of file RandomMovement.cpp.
| void set_track_flag | ( | bool | track_flag ) |
Field Documentation
bool direction_ [protected, inherited] |
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 random_direction_ [protected, inherited] |
Random direction variable.
Definition at line 43 of file RandomMovement.h.
int random_move_counter_ [protected, inherited] |
Sprite random move counter.
Definition at line 40 of file RandomMovement.h.
int sprite_x_length [protected, inherited] |
Length of sprite in x direction.
Definition at line 27 of file CheckCollision.h.
int sprite_y_length [protected, inherited] |
Length of sprite in y direction.
Definition at line 30 of file CheckCollision.h.
Generated on Fri Aug 5 2022 06:55:08 by
1.7.2