// Jetpac remake using Irrlicht // Copyright Gaz Davidson (gaz@bitplane.net) /* Use at your own risk! Jetpac is a game by Ultimate: Play the Game, who afaik are now owned by Microsoft. It's all my own work but I've tried to stay true to the original, which may or may not constitute a copyright violation. */ #ifndef __JETPAC_H_INCLUDED__ #define __JETPAC_H_INCLUDED__ #include #include "EZXColour.h" // game states enum STATES { STATE_MENU, // the menu STATE_GAMEOVER, // game over screen STATE_PLAYING, // playing the game STATE_LOST_LIFE, // just lost a life, waiting... STATE_LAUNCH, // launching STATE_PAUSED, // pause game (P key) STATE_QUIT // the game is exiting }; // gameplay constants, toyed with during development namespace irr { const f32 Thrust = 0.0001f; const f32 SideThrust = 0.0001f; const f32 WalkSpeed = 0.0025f; const f32 Resistance = 0.991f; const core::vector2df MaxSpeed(0.007f, 0.01f); const f32 Gravity = 0.003f; const s32 MaxEnemies = 5; const s32 MaxBullets = 6; const f32 PhaserSpeed = 0.02f; const u32 TimeBetweenShots = 100; // layout variables const f32 MaxY = 6.0f; const f32 MaxX = 5.0f; // gfx const f32 PhaserWidth = 0.01f; } // irr #include "GameEntity.h" #include "Billboard.h" #include "Player.h" #include "Enemy.h" #include "Bonus.h" #include "Rocket.h" #include "Ledge.h" #include "PhaserFire.h" #include "Explosion.h" namespace irr { namespace scene { class JetPac : public IEventReceiver { public: JetPac(); ~JetPac(); // clear everything and start a new game void newGame(); // change the game state void setState(STATES state); // start the level bool startLevel(); // load the game resources void loadResources(); // start the game loop (loops in here) void run(); // create stuff... void spawnThings(); // set the score in the gui void setScore(s32 newScore); // set the lives in the gui void setLives(s32 l); // update the high score in the gui void setHiScore(s32 newScore); // do game logic and collisions void logicAndCollisions(); // irrlicht event receiever, do keyboard input (usually forwards to player) virtual bool OnEvent(const SEvent& e); private: // business as usual IrrlichtDevice *device; ISceneManager *smgr; video::IVideoDriver *driver; gui::IGUIEnvironment *env; // game state stuff s32 Lives, Score, HiScore, Level; u32 NextFuelTime, NextBonusTime, NextEnemyTime, NextMenuTime, NextShootTime, NextFlashTime, NextExtraLife; // game resources IMesh *rocketBaseMesh, *rocketBodyMesh, *rocketConeMesh, *fuelMesh, *platformMesh; core::array BadGuyTextures; core::array ExplosionTextures; core::array PlayerTextures; core::array BonusMeshes; gui::IGUIFont *font; // scene stuff ICameraSceneNode *Camera; Player *player; Rocket *ship; core::array platforms; core::array enemies; core::array collectables; core::array bullets; // gui gui::IGUIStaticText *ScoreText, *HiScoreText, *LivesText, *GameOverText, *MenuText; STATES State; }; } // scene } // irr #endif