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.
Dependencies: mbed
Badman.cpp
00001 #include "Badman.h" 00002 00003 00004 //Default badman character object constructor 00005 Badman::Badman(){ 00006 } 00007 00008 //Default badman character object destructor 00009 Badman::~Badman(){ 00010 } 00011 00012 //Mutator method initialises the badman character object by setting it's initial start position 00013 //and it's size to the value passed as the parameter in the function call 00014 void Badman::init(int size){ 00015 _size = size; 00016 _x = 4; 00017 _y = 3; 00018 00019 } 00020 00021 //Mutator method draws the badman object on the screen dependent on the coordinates of the centre of the badman object 00022 void Badman::draw(N5110 &lcd){ 00023 lcd.drawCircle(_x,_y,_size,FILL_BLACK); 00024 } 00025 00026 //Accessor method returns the centre coordinates of the badman character object 00027 Vector2D Badman::getPos(){ 00028 Vector2D p = {_x,_y}; 00029 return p; 00030 } 00031 00032 //Mutator method sets the centre coordinates of the badman character object to 00033 //the integer values passed as the parameters of the method in the function call 00034 void Badman::setPos(int x,int y){ 00035 _x = x; 00036 _y = y; 00037 } 00038 00039 //Accessor method returns the value of the radius of the badman character object 00040 //denoted by the _size private variable 00041 int Badman::getSize(){ 00042 return _size; 00043 } 00044
Generated on Thu Aug 4 2022 12:05:20 by
1.7.2