- improved entity binding
- added structures, villagers, and a basic villager AI
+9/26/2015:
+==========
+
+ - added a base for indoor areas
vec2 vel;
bool right,left, canMove;
bool alive;
+ bool ground;
unsigned int texture[];
IndoorWorld(void);
~IndoorWorld(void);
- void generate(unsigned int width);
- void draw(vec2 *vec);
+ void generate(unsigned int width); // Generates a flat world of width 'width'
+ void draw(vec2 *vec); // Draws the world (ignores layers)
};
#endif // WORLD_H
left = false;
ticksToUse = 0;
canMove = false;
+ ground = false;
}
void Entity::draw(void){
type = 0;
subtype = 5;
alive = true;
+ ground = false;
}
void Player::interact(){
}
void NPC::interact(){
- loc.y += .01;
-
+ //loc.y += .01;
}
Structures::Structures(){
player->vel.x=.15;
currentWorld=currentWorld->goWorldRight(player);
}
- if(SDL_KEY==SDLK_SPACE)player->vel.y=.25; // Jump
+ if(SDL_KEY==SDLK_SPACE){ // Jump
+ if(player->ground){
+ player->vel.y=.25;
+ player->ground=false;
+ }
+ }
if(SDL_KEY==SDLK_i)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_F3)debug^=true;
i=(e->loc.x+e->width/2-x_start)/HLINE; // Calculate what line the player is currently on
if(e->loc.y<=line[i].y){ // Snap the player to the top of that line if the player is inside it
e->vel.y=0;
+ e->ground=true;
e->loc.y=line[i].y+HLINE/2;
}else{ // If the player is above the ground do some gravity stuff
e->vel.y-=.01;