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.
Life_Powerup.cpp
00001 #include "Life_Powerup.h" 00002 00003 Life_Powerup::Life_Powerup() 00004 { 00005 00006 } 00007 00008 Life_Powerup::~Life_Powerup() 00009 { 00010 00011 } 00012 00013 void Life_Powerup::init() // initialises the Life_Powerup off screen 00014 { 00015 _x = -10; 00016 _y = 0; 00017 _speed_y = 1; // -2 speed in the y direction, doesnt change even off screen 00018 } 00019 00020 00021 void Life_Powerup::draw(N5110 &lcd) 00022 { 00023 if (_x >= 0) { // only draw if on screen (more efficient?) 00024 Bitmap powerup(powerup_data, 9, 9); // assign the powerup sprite data 00025 powerup.render(lcd,_x,_y); 00026 } 00027 } 00028 00029 00030 void Life_Powerup::update() // updates the Life_Powerup's y coordinate according to its speed 00031 { 00032 _y += _speed_y; 00033 } 00034 00035 00036 int Life_Powerup::get_x() // retrieves the Life_Powerups's x coordinate 00037 { 00038 return _x; 00039 } 00040 00041 00042 int Life_Powerup::get_y() // retrieves the Life_Powerups's y coordinate 00043 { 00044 return _y; 00045 } 00046 00047 00048 void Life_Powerup::set_posx(int x) // sets the Life_Powerup's x coordinate 00049 { 00050 _x = x; 00051 } 00052 00053 00054 void Life_Powerup::set_posy(int y) // sets the Life_Powerups's y coordinate 00055 { 00056 _y = y; 00057 }
Generated on Wed Jul 13 2022 09:05:52 by
1.7.2