Platform game written for the GHI/OutrageousCircuits RETRO game device. Navigate the caves collecting all the pickups and avoiding the creatures and haunted mine carts that patrol the caves. Oh and remember to watch out for the poisonous plants... This game demonstrates the ability to have multiple animated sprites where the sprites can overlap the background environment. See how the player moves past the fence and climbs the wall in the 3rd screen.
Revision 16:f9227904afc4, committed 2015-02-16
- Comitter:
- taylorza
- Date:
- Mon Feb 16 03:46:57 2015 +0000
- Parent:
- 15:5d3f65500736
- Commit message:
- Added a 4th game screen
Changed in this revision
diff -r 5d3f65500736 -r f9227904afc4 Maps.cpp --- a/Maps.cpp Mon Feb 16 02:45:57 2015 +0000 +++ b/Maps.cpp Mon Feb 16 03:46:57 2015 +0000 @@ -59,4 +59,23 @@ 1,1,1,0,0,1,1,8,8,8,8,0,0,0,0,0,0,0,0,1, 1,1,1,9,9,1,1,8,8,8,8,0,0,0,9,0,0,0,0,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +}; + +// 20 x 15 +const uint8_t Maps::Screen4[] = { + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,1, + 1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,1, + 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1, + 1,0,0,0,0,0,1,1,1,5,0,0,0,0,0,0,0,0,5,1, + 1,0,0,9,1,1,5,5,0,0,0,0,0,0,0,0,0,0,10,1, + 1,0,0,1,1,5,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 1,0,0,0,0,0,0,0,0,9,0,0,0,11,0,0,0,0,0,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, }; \ No newline at end of file
diff -r 5d3f65500736 -r f9227904afc4 Maps.h --- a/Maps.h Mon Feb 16 02:45:57 2015 +0000 +++ b/Maps.h Mon Feb 16 03:46:57 2015 +0000 @@ -7,5 +7,6 @@ static const uint8_t Screen1[]; static const uint8_t Screen2[]; static const uint8_t Screen3[]; + static const uint8_t Screen4[]; }; #endif // __MAPS_H__ \ No newline at end of file
diff -r 5d3f65500736 -r f9227904afc4 Screen4.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Screen4.h Mon Feb 16 03:46:57 2015 +0000 @@ -0,0 +1,42 @@ +#ifndef __SCREEN4_H__ +#define __SCREEN4_H__ + +class Screen4 : public Scene +{ +public: + Screen4() : + _player(), + _enemy1(3, PatrollingEnemy::LeftRight), + _enemy2(4) + { + Game::Surface.clearScreen(); + + addGameObject(&_enemy1); + addGameObject(&_enemy2); + addGameObject(&_player); + + restartScreen(); + } + + virtual void restartScreen() + { + _player.setStartPosition(10, 16); + + _enemy1.setStartPosition(72, 48); + _enemy1.setCollisionRect(0, 6, 16, 16); + + _enemy2.setStartPosition(88, 78); + + setPosition(0, 8); + setMap(Maps::Screen4, 20, 15, blocks, sprites); + + Scene::restartScreen(); + } + +private: + Player _player; + PatrollingEnemy _enemy1; + BouncingEnemy _enemy2; +}; + +#endif //__SCREEN4_H__
diff -r 5d3f65500736 -r f9227904afc4 main.cpp --- a/main.cpp Mon Feb 16 02:45:57 2015 +0000 +++ b/main.cpp Mon Feb 16 03:46:57 2015 +0000 @@ -10,6 +10,7 @@ #include "Screen1.h" #include "Screen2.h" #include "Screen3.h" +#include "Screen4.h" class MyGame : public Game { @@ -27,13 +28,13 @@ virtual void completeScreen() { _intro = false; - if (_screen == 2) + if (_screen == 3) { increaseSpeed(10); addLives(1); } - _screen = (_screen + 1) % 3; + _screen = (_screen + 1) % 4; Scene *pCur = getScene(); if (pCur != NULL) delete pCur; @@ -43,6 +44,7 @@ case 0 : setScene(new Screen1); break; case 1 : setScene(new Screen2); break; case 2 : setScene(new Screen3); break; + case 3 : setScene(new Screen4); break; } };