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.
Diff: Character/Character.cpp
- Revision:
- 4:b16b6078a432
- Parent:
- 3:fcc9cf213a61
- Child:
- 9:62fe47a1374f
--- a/Character/Character.cpp Mon May 18 11:38:28 2020 +0000
+++ b/Character/Character.cpp Mon May 18 15:42:26 2020 +0000
@@ -30,28 +30,19 @@
0,1,1,1,1
};
//turning the sprite
- if (_dir == 0) {
- for(int i = 0; i < 25; i++){
+ for(int i = 0; i < 25; i++){
sprite_data[i] = 1;
}
+ if (_dir == 0) {
sprite_data[0] = 0;
sprite_data[4] = 0;
} else if (_dir == 1) {
- for(int i = 0; i < 25; i++){
- sprite_data[i] = 1;
- }
sprite_data[4] = 0;
sprite_data[24] = 0;
} else if (_dir == 2) {
- for(int i = 0; i < 25; i++){
- sprite_data[i] = 1;
- }
sprite_data[20] = 0;
sprite_data[24] = 0;
} else if (_dir == 3) {
- for(int i = 0; i < 25; i++){
- sprite_data[i] = 1;
- }
sprite_data[0] = 0;
sprite_data[20] = 0;
}
@@ -64,7 +55,7 @@
void Character::update(Direction d,float mag)
{
- _speed = int(mag*2.0f); //scale of speed
+ _speed = 1; //scale of speed
//printf statements for speed
//pcc.printf("speed = %d \n", _speed);
@@ -110,3 +101,16 @@
{ //Accessor function for level
return _level;
}
+int Character::get_x()
+{
+ return _x;
+
+}
+int Character::get_y()
+{
+ return _y;
+
+}
+int Character::get_direction(){
+ return _dir;
+ }