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: Game/Game.cpp
- Revision:
- 25:1d3bf74dddeb
- Parent:
- 24:7770c7f27cdc
- Child:
- 26:3652bc2fe3fc
diff -r 7770c7f27cdc -r 1d3bf74dddeb Game/Game.cpp
--- a/Game/Game.cpp Thu May 09 12:46:52 2019 +0000
+++ b/Game/Game.cpp Thu May 09 13:43:23 2019 +0000
@@ -13,7 +13,7 @@
void Game::init()
{
// set character coordinates and health //
- smiley.init(x, y);
+ baby.init(x, y);
_health = 10;
// initialise all coin coordinates //
@@ -83,13 +83,13 @@
enemyB.drawSpriteB(lcd);
enemy2.drawSprite2(lcd);
enemyC.drawSpriteC(lcd);
- smiley.drawSprite(lcd);
+ baby.drawSprite(lcd);
}
void Game::movement(N5110 &lcd, Gamepad &pad)
{
// all sprite movement //
- smiley.movement(dir, lcd);
+ baby.movement(dir, lcd);
enemyA.movementA(lcd);
enemy1.movement1(lcd);
enemyB.movementB(lcd);
@@ -100,8 +100,8 @@
void Game::collect(N5110 &lcd, Gamepad &pad)
{
// detects whether the coin needs to be respawned //
- int x = smiley.get_x_char();
- int y = smiley.get_y_char();
+ int x = baby.get_x_char();
+ int y = baby.get_y_char();
coin1.spawn(x, y, lcd, pad);
coin2.spawn(x, y, lcd, pad);
coin3.spawn(x, y, lcd, pad);
@@ -134,8 +134,8 @@
void Game::damage(N5110 &lcd, Gamepad &pad)
{
// if collision with enemy detected -1 live //
- int x = smiley.get_x_char();
- int y = smiley.get_y_char();
+ int x = baby.get_x_char();
+ int y = baby.get_y_char();
if (enemyA.collidePlayer(x, y, pad) == true ||
enemy1.collidePlayer(x, y, pad) == true ||
enemyB.collidePlayer(x, y, pad) == true ||