Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of fy15raf by
Spaceship.h
00001 #ifndef SPACESHIP_H 00002 #define SPACESHIP_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 00008 /** Spaceship Class 00009 * @brief class create the Spaceship 00010 * @author Reham Faqehi 00011 * @date May, 2018 */ 00012 00013 class Spaceship 00014 { 00015 public: 00016 00017 /** Constructor */ 00018 Spaceship(); 00019 00020 /** Destructor */ 00021 ~Spaceship(); 00022 00023 /** Initialise the Spaceship position, 00024 * speed and number of collisions. 00025 */ 00026 void init(); 00027 00028 /** Draw sprite for the Spaceship shape 00029 * @param LCD object (N5110) 00030 */ 00031 void draw(N5110 &lcd); 00032 00033 /** Update the Spaceship movements 00034 * @param Direction d and magnitude (float) 00035 */ 00036 void update(Direction d,float mag); 00037 00038 /** Get the Spaceship position 00039 * @return the current position 00040 */ 00041 Vector2D get_pos(); 00042 00043 /** Increase the number of 00044 * collisions 00045 */ 00046 void add_collisions(); 00047 00048 /** Get the number of 00049 * collisions 00050 * @return the current collision number 00051 */ 00052 int get_collisions(); 00053 00054 /** Draw sprite for 3 hearts 00055 * @param LCD object (N5110) 00056 */ 00057 void drawFullHearts(N5110 &lcd); 00058 00059 /** Draw sprite for 2 hearts only 00060 * @param LCD object (N5110) 00061 */ 00062 void drawTwoHearts(N5110 &lcd); 00063 00064 /** Draw sprite for 1 heart only 00065 * @param LCD object (N5110) 00066 */ 00067 void drawOneHeart(N5110 &lcd); 00068 00069 private: 00070 00071 int _x; 00072 int _y; 00073 int _speed; 00074 Vector2D p; 00075 int _collision; 00076 00077 }; 00078 #endif
Generated on Thu Jul 14 2022 18:15:41 by
