ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Diff: Engine/Engine.cpp
- Revision:
- 13:cb5ed2f0cbd5
- Parent:
- 12:eb8d30593e95
- Child:
- 14:58887d7e1072
diff -r eb8d30593e95 -r cb5ed2f0cbd5 Engine/Engine.cpp --- a/Engine/Engine.cpp Wed May 27 04:22:47 2020 +0000 +++ b/Engine/Engine.cpp Wed May 27 04:36:22 2020 +0000 @@ -103,7 +103,8 @@ //updates enemy file void Engine::update(Gamepad &pad) { - fellDown(); + //fellDown(); + coinTaken(); floorCollide(); //enemyCollide(); //spawnEnemy(); @@ -163,6 +164,15 @@ } +////////////////////// GOT COIN ///////////////////////////////////////// +void Engine::coinTaken(){ + coinPos = coin.get_pos(); + if(player.x+4 >= coinPos.x-2 & player.y+4 >= coinPos.y-2 & player.x+4 <= coinPos.x+2 & player.y+4 <= coinPos.x+2){ + coin.set_pos(10, 10); + } + } + + ////////////////////// ENNEMY COLLIDE /////////////////////////////////// bool Engine::enemyCollide()