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
Diff: Enemy/Enemy.cpp
- Revision:
- 10:71ced616a64f
- Parent:
- 9:62fe47a1374f
- Child:
- 14:2d7e41f46879
diff -r 62fe47a1374f -r 71ced616a64f Enemy/Enemy.cpp
--- a/Enemy/Enemy.cpp Sat May 23 13:26:19 2020 +0000
+++ b/Enemy/Enemy.cpp Sun May 24 21:20:40 2020 +0000
@@ -1,10 +1,8 @@
#include "Enemy.h"
#include <Bitmap.h>
Serial pce(USBTX, USBRX);
-// nothing doing in the constructor and destructor
Enemy::Enemy(int seed)
{
- _dead = false;
srand(seed);
four = (rand()%4)+1;
//pce.printf("%d",four);
@@ -42,7 +40,6 @@
void Enemy::update(int player_x, int player_y)
{
- if(_dead == false){
if(_x<player_x){
_x++;
}
@@ -56,7 +53,7 @@
else if (_y > player_y){
_y--;
}
- }
+
}
int Enemy::get_x()
{
@@ -68,12 +65,7 @@
return _y;
}
-void Enemy::dead(){
- _dead = true;
- _x = 2147483647;
-}
void Enemy::reset(int seed){
- _dead = false;
srand(seed);
four = (rand()%4)+1;
//pce.printf("%d",four);