Gerard-Meier

Player startpoint Decorator

Apr 21st, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #ifndef STARTPOINT_H
  2. #define STARTPOINT_H
  3.  
  4. #include "Empty.h"
  5. #include "json/writer.h"
  6.  
  7. using namespace std;
  8.  
  9. class StartPoint : public Empty {
  10. public:
  11.     virtual void applyTo(json::Object& starSystem, json::Array& gameObjects) {
  12.         // Since the player is within this starsystem, it makes sense to make it
  13.         // visible too. This is just a default state when the player starts a game.
  14.         starSystem["visible"] = json::Boolean(true);
  15.  
  16.         // Very trivially add the player.
  17.         gameObjects.Insert(createGameObjectJson("starship", 100, 100, -100));
  18.     }
  19. };
  20.  
  21. #endif // STARTPOINT_H
Advertisement
Add Comment
Please, Sign In to add comment