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:
- 12:c557b6c9b17a
- Parent:
- 10:71ced616a64f
- Child:
- 13:217c6102ffc0
--- a/Character/Character.cpp Sun May 24 21:21:26 2020 +0000
+++ b/Character/Character.cpp Mon May 25 17:22:06 2020 +0000
@@ -52,13 +52,11 @@
sprite.render(lcd, _x, _y);
}
-void Character::update(Direction d,float mag)
+void Character::update(Direction d)
{
_speed = 1; //scale of speed
-
//printf statements for speed
//pcc.printf("speed = %d \n", _speed);
-
// update x and y value depending on direction of movement
// Set direction and speed according to north south directions
if (d == N) {
@@ -77,20 +75,10 @@
//testing _x and _y
//pcc.printf("x = %d \n", _x);
//pcc.printf("y = %d \n", _y);
-
- // check the x and y position] to ensure that the paddle doesn't go off screen
- if (_x < 1) {
- _x = 1;
- }
- if (_y < 1) {
- _y = 1;
- }
- if (_x > 79){
- _x = 79;
- }
- if (_y > 43){
- _y = 43;
- }
+ if (_x < 1) { _x = 1; }// check the x and y position] to ensure that the paddle doesn't go off screen
+ if (_y < 1) { _y = 1; }
+ if (_x > 79){ _x = 79; }
+ if (_y > 43){ _y = 43; }
}
int Character::get_x()
{