diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/entities.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 8 | ||||
-rw-r--r-- | src/ui.cpp | 4 | ||||
-rw-r--r-- | src/world.cpp | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 1058b1b..3560a2d 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -91,7 +91,7 @@ unsigned int Structures::spawn(_TYPE t, float x, float y){ //spawns a structure entity[entity.size()] = &npc[npc.size()-1]; //set the new entity to have the same traits as an NPC entity[entity.size()-1]->spawn(loc.x + (float)(i - 5),100); //sets the position of the villager around the village } - entity.pop_back(); + entity.pop_back(); return entity.size(); } } diff --git a/src/main.cpp b/src/main.cpp index 5c4fb77..d36929a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,10 +13,10 @@ SDL_Surface *renderSurface = NULL; SDL_GLContext mainGLContext = NULL; bool gameRunning = true; -static unsigned int tickCount = 0, - prevTime = 0, - currentTime = 0, - deltaTime = 0; +unsigned int tickCount = 0, + prevTime = 0, + currentTime = 0, + deltaTime = 0; World *currentWorld=NULL; Player *player; @@ -157,8 +157,8 @@ namespace ui { if(SDL_KEY==SDLK_w)currentWorld=currentWorld->goInsideStructure(player); if(SDL_KEY==SDLK_SPACE){ // Jump if(player->ground){ - player->vel.y=.25; - //player->loc.y+=HL + player->vel.y=.5; + player->loc.y+=HLINE*2; player->ground=false; } } diff --git a/src/world.cpp b/src/world.cpp index 9f60a4a..7d27e17 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -131,7 +131,7 @@ void World::singleDetect(Entity *e){ for(i=0;i<platform.size();i++){ if(((e->loc.x+e->width>platform[i].p1.x)&(e->loc.x+e->width<platform[i].p2.x))|| ((e->loc.x<platform[i].p2.x)&(e->loc.x>platform[i].p1.x))){ - if(e->loc.y>platform[i].p2.y-HLINE&&e->loc.y<platform[i].p2.y){ + if(e->loc.y>platform[i].p1.y&&e->loc.y<platform[i].p2.y){ if(e->vel.y<0){ e->vel.y=0; e->loc.y=platform[i].p2.y; @@ -141,7 +141,7 @@ void World::singleDetect(Entity *e){ } } } - e->vel.y-=.01; + e->vel.y-=.001*deltaTime; }else{ e->vel.y=0; e->ground=true; |