Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RandomMovement.h Source File

RandomMovement.h

00001 #ifndef RANDOMMOVEMENT_H
00002 #define RANDOMMOVEMENT_H
00003 
00004 // Included Headers ------------------------------------------------------------
00005 #include "mbed.h"
00006 #include "Position.h"
00007 
00008 /** Random Movement class
00009 * @brief Random Movement parent class
00010 * @author Benjamin Evans, University of Leeds
00011 * @date May 2020
00012 */         
00013 class RandomMovement: virtual public Position{    
00014     protected: 
00015     // Function prototypes -----------------------------------------------------
00016     
00017         /** Changes the x and y positions of the sprite object depending on the  
00018          * movement direction 
00019          * @param x_change @details number to change sprite x position by
00020          * @param y_change @detials number to change sprite y position by
00021          */
00022         void set_sprite_direction(int x_change,int y_change);
00023         
00024         /** Generates the random move direction and length for the sprite */
00025         void set_random_move();
00026         
00027         /** Gets the movement direction of the sprite */
00028         void move_direction();
00029         
00030         /** Calculates the sprite movement depending on spaceship positions and 
00031          * joystick input 
00032          * @param d_ @details : Direction object of joystick
00033          * @return integer @details move alien value for alien draw function 
00034          */
00035         int calc_sprite_movement(Direction d_);
00036         
00037     // Variables ---------------------------------------------------------------
00038         
00039         /** Sprite random move counter */
00040         int random_move_counter_;
00041          
00042         /** Random direction variable */
00043         int random_direction_;  
00044 };
00045  
00046 #endif