]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Shit
authordrumsetmonkey <abelleisle@roadrunner.com>
Mon, 14 Dec 2015 13:43:23 +0000 (08:43 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Mon, 14 Dec 2015 13:43:23 +0000 (08:43 -0500)
1  2 
include/common.h
include/entities.h
include/world.h
main.cpp
src/entities.cpp
src/gameplay.cpp
src/world.cpp

Simple merge
index dbaf9f56579cc54eda27d4eb87be5669262e0e75,dd3adabb695f8d60fd49e54276b0feff1fff4221..141d29a25856086198778e658896b57aa810e237
@@@ -34,51 -34,6 +34,50 @@@ enum MOB_SUB 
        MS_TRIGGER
  };
  
-               if(duration <= 0){
 +enum BUILD_SUB{
 +      TOWN_HALL = 1,
 +      HOUSE,
 +      HOUSE2,
 +      HOUSE3,
 +      HOUSE4,
 +      FOUNTAIN
 +};
 +
 +class Particles{
 +public:
 +      vec2 loc;
 +      float width;
 +      float height;
 +      float velx;
 +      float vely;
 +      Color color;
 +      int duration;
 +      bool canMove;
 +      Particles(float x, float y, float w, float h, float vx, float vy, Color c, int d){
 +              loc.x = (x);
 +              loc.y = (y);
 +              width = (w);
 +              height = (h);
 +              velx = vx;
 +              vely = vy;
 +              color.red = (c.red);
 +              color.green = (c.green);
 +              color.blue = (c.blue);
 +              duration = d;
 +      }
 +      ~Particles(){}
 +      void draw(){
 +              glColor3f(color.red,color.green,color.blue);
 +              glRectf(loc.x,loc.y,loc.x+width,loc.y+height);
 +      }
 +      bool kill(float delta){
 +              duration -= delta;
-               }
++              if(duration <= 0)
 +                      return true;
 +              else return false;
 +      }
 +};
 +
  class Entity{
  public:
        Inventory *inv;
diff --cc include/world.h
Simple merge
diff --cc main.cpp
Simple merge
Simple merge
index 54ef432d293f68e5418ce78219735101d127312d,74414d705a073c54ad93cd538137f68bcb4eacbd..59320af3a2b8dc969e1bd0bb08b8780bbd10ef99
@@@ -58,93 -58,75 +58,89 @@@ void worldSpawnHill3_itemGet(Mob *calle
        callee->alive = false;
  }
  
- float playerSpawnHillFunc(float x){
-       return (float)(pow(2,(-x+200)/5) + 80);
+ void worldSpawnHill3_itemSee(Mob *callee){
+       ui::dialogBox("B-) ",NULL,true,"Press \'e\' to open your inventory!");
+       callee->alive = false;
  }
  
- static World *test;
- static World *playerSpawnHill;
- static IndoorWorld *iw;
+ void worldSpawnHill3_leave(Mob *callee){
+       ui::dialogBox("B-) ",NULL,true,"Now jump in this hole, and let your journey begin :)");
+       callee->alive = false;
+ }
  
- void destroyEverything(void);
+ /*
+  *    new world 
+  *    gen
+  *    setbackground
+  *    setbgm
+  *    add...
+  * 
+  */
+ /*
+  *    World definitions
+  */
+ static World *worldSpawnHill1;
+ static World *worldSpawnHill2;
+ static World *worldSpawnHill3;
  
+ /*
+  *    initEverything() start
+  */
+ void destroyEverything(void);
  void initEverything(void){
-       //FILE *load;
-       
-       /*
-        *      World creation:
-       */
-       
-       test=new World();
-       
-       test->generate(SCREEN_WIDTH*2);
-       test->setBackground(BG_FOREST);
-       test->setBGM("assets/music/embark.wav");
-       
-       test->addHole(100,150);
-       test->addLayer(400);
-       
-       playerSpawnHill=new World();
-       playerSpawnHill->setBackground(BG_FOREST);
-       playerSpawnHill->setBGM("assets/music/embark.wav");
-       
-       /*if((load=fopen("world.dat","rb"))){
-               playerSpawnHill->load(load);
-               fclose(load);
-       }else{*/
-               playerSpawnHill->generateFunc(1280,playerSpawnHillFunc);
-       //}
  
-       /*
-        *      Setup the current world, making the player initially spawn in `test`.
-       */
-       
-       currentWorld=playerSpawnHill;
-       
-       playerSpawnHill->toRight=test;
-       test->toLeft=playerSpawnHill;
-       
-       /*
-        *      Create the player.
-       */
-       
-       player=new Player();
-       player->spawn(-1000,200);
-       
-       /*
-        *      Create a structure (this will create villagers when spawned).
-       */
-       
-       iw=new IndoorWorld();
-       iw->setBackground(BG_WOODHOUSE);
-       iw->setBGM(NULL);
-       iw->generate(200);
-       iw->addMob(MS_TRIGGER,0,0,CUTSCENEEE2);
-       
+       worldSpawnHill1 = new World();
+       worldSpawnHill1->generateFunc(400,gen_worldSpawnHill1);
+       worldSpawnHill1->setBackground(BG_FOREST);
+       worldSpawnHill1->setBGM("assets/music/embark.wav");
+       worldSpawnHill1->addMob(MS_TRIGGER,0,0,worldSpawnHill1_hillBlock);
+       worldSpawnHill2 = new World();
+       worldSpawnHill2->generate(700);
+       worldSpawnHill2->setBackground(BG_FOREST);
+       worldSpawnHill2->setBGM("assets/music/embark.wav");
+       worldSpawnHill2->addMob(MS_TRIGGER,-400,0,worldSpawnHill2_infoSprint);
 -      
++
+       worldSpawnHill3 = new World();
+       worldSpawnHill3->generateFunc(1000,gen_worldSpawnHill3);
+       worldSpawnHill3->setBackground(BG_FOREST);
+       worldSpawnHill3->setBGM("assets/music/embark.wav");
+       worldSpawnHill3->addMob(MS_TRIGGER,-500,0,worldSpawnHill3_itemGet);
+       worldSpawnHill3->addMob(MS_TRIGGER,0,0,worldSpawnHill3_itemSee);
+       worldSpawnHill3->addObject(TEST_ITEM,false,"",-200,300);
+       worldSpawnHill3->addMob(MS_TRIGGER,400,0,worldSpawnHill3_leave);
+       worldSpawnHill3->addHole(800,1000);
+       
+       worldSpawnHill1->toRight = worldSpawnHill2;
+       worldSpawnHill2->toLeft = worldSpawnHill1;
 -      
+       worldSpawnHill2->toRight = worldSpawnHill3;
+       worldSpawnHill3->toLeft = worldSpawnHill2;
 -      
++
 +      /*
 +       *      Spawn some entities.
 +      */
 +
-       playerSpawnHill->addMob(MS_TRIGGER,player->loc.x,0,story);
++      //playerSpawnHill->addMob(MS_TRIGGER,player->loc.x,0,story);
 +
-       playerSpawnHill->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,test,iw);
-       playerSpawnHill->addStructure(STRUCTURET,FOUNTAIN,(rand()%120*HLINE)+100*HLINE,100,test,iw);
++      //worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill1,worldSpawnHill2);
++      //playerSpawnHill->addStructure(STRUCTURET,FOUNTAIN,(rand()%120*HLINE)+100*HLINE,100,test,iw);
 +      //playerSpawnHill->addStructure(STRUCTURET,HOUSE2,(rand()%120*HLINE)+300*HLINE,100,test,iw);
 +
 +      //playerSpawnHill->addVillage(5,1,4,STRUCTURET,rand()%500+120,(float)200,playerSpawnHill,iw);
-       playerSpawnHill->addMob(MS_TRIGGER,-1300,0,CUTSCENEEE);
-       
-       playerSpawnHill->addObject(SWORD_WOOD, false, "", 480,200);
-       playerSpawnHill->addObject(FLASHLIGHT, false, "", 500,200);
-       playerSpawnHill->addObject(PLAYER_BAG, false, "", 520,200);
-       playerSpawnHill->addObject(TEST_ITEM, false, "", 540,200);
++      //playerSpawnHill->addMob(MS_TRIGGER,-1300,0,CUTSCENEEE);*/
++
++
+       currentWorld = worldSpawnHill1;
++      worldSpawnHill2->addStructure(STRUCTURET,FOUNTAIN,(rand()%120*HLINE)+100*HLINE,100,worldSpawnHill2,worldSpawnHill2);
        
-       test->addMob(MS_RABBIT,200,100);
-       test->addMob(MS_BIRD,-500,500);
+       player = new Player();
+       player->spawn(200,100);
        
-       playerSpawnHill->npc[0]->addAIFunc(giveTestQuest,false);
+       currentWorld->bgmPlay(NULL);
        
-       currentWorld->bgmPlay();
        atexit(destroyEverything);
  }
  
diff --cc src/world.cpp
Simple merge