]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
fixed world
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 29 Oct 2015 12:13:09 +0000 (08:13 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 29 Oct 2015 12:13:09 +0000 (08:13 -0400)
include/common.h
include/world.h
src/ui.cpp
src/world.cpp

index 6d11c57445626bb7a531e500913e7a66d46fb604..3c83e668058f0ae4961ddaeec65db667db3f6c32 100644 (file)
@@ -49,9 +49,8 @@ typedef struct {
 
 #define GAME_NAME              "Independent Study v.0.2 alpha"
 
-#define SCREEN_WIDTH   1920
-#define SCREEN_HEIGHT  1080
-#define FULLSCREEN
+#define SCREEN_WIDTH   1280
+#define SCREEN_HEIGHT  720
 
 //#define FULLSCREEN
 
@@ -66,7 +65,7 @@ typedef struct {
  * 
 */
 
-#define HLINE 3        // 3 as in 3 pixels
+#define HLINE 2        // 3 as in 3 pixels
 
 /*
  *     Define 'our' random number generation library. Eventually these macros will be replaced
index 03b0d969b6208a6ffa4e7beda3ccae99412c0514..ef9ef6ec996157cbfe49c1a4b11af31c5fcfea69 100644 (file)
@@ -36,7 +36,6 @@ protected:
        void singleDetect(Entity *e);   // Handles an individual entity (gravity n' stuff)
 public:
        unsigned int lineCount;         // Size of the array 'line' (aka the width of the world)
-       unsigned int worldWidth;
        World *toLeft,*toRight;         // Pointers to areas to the left and right of this world. These are made public
                                                                // so that they can easily be set without a function.
        World *infront;
@@ -71,6 +70,8 @@ public:
        void addPlatform(float x,float y,float w,float h);      // Dynamically adds a platform to the platform array. These will be automatically
                                                                                                                // drawn and handled by the world.
        void addHole(unsigned int start,unsigned int end);      // Create a hole in the world
+       
+       int getWidth(void);
 };
 
 float worldGetYBase(World *w);
index 8f19e3424ef9310d3ffba889ee7947424cc02532..e6d18d2d3125678b850ee432b80397830c5130d8 100644 (file)
@@ -237,7 +237,11 @@ namespace ui {
                                                player->ground=false;
                                        }
                                }
-                               if(SDL_KEY==SDLK_i)currentWorld=currentWorld->goWorldBack(player);      // Go back a layer if possible
+                               if(SDL_KEY==SDLK_i){
+                                       player->vel.y=.5;
+                                       player->ground=false;
+                                       currentWorld=currentWorld->goWorldBack(player); // Go back a layer if possible  
+                               }
                                if(SDL_KEY==SDLK_k)currentWorld=currentWorld->goWorldFront(player);     // Go forward a layer if possible
                                if(SDL_KEY==SDLK_LSHIFT)player->speed = 3;                                                      // Sprint
                                if(SDL_KEY==SDLK_LCTRL)player->speed = .5;
index 9fe76b0a2bce44c2027fc53f2513425c7693eff5..ec91c0271de9c9c0b2e2ea12acba784ca8f8c603 100644 (file)
@@ -42,7 +42,6 @@ World::World(void){
 }
 
 void World::generate(unsigned int width){      // Generates the world and sets all variables contained in the World class.
-       worldWidth = width;
        unsigned int i;
        float inc;
        
@@ -582,6 +581,10 @@ void World::addHole(unsigned int start,unsigned int end){
        }
 }
 
+int World::getWidth(void){
+       return -x_start;
+}
+
 IndoorWorld::IndoorWorld(void){
 }