From 7d974f6f4d54b3fbea99780ddf6e395b217065bc Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Mon, 14 Sep 2015 11:51:05 -0400 Subject: Added NPC Stuff Added Wandering, and variable spawning amounts --- include/common.h | 6 +++++- include/entities.h | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/common.h b/include/common.h index e1b536f..f32aad0 100644 --- a/include/common.h +++ b/include/common.h @@ -15,7 +15,8 @@ typedef struct{float x; float y;}vec2; #include #define SCREEN_WIDTH 1280 -#define SCREEN_HEIGHT 800 +#define SCREEN_HEIGHT 720 +#define SCREEN_RATIO (float)SCREEN_WIDTH/(float)SCREEN_HEIGHT //#define FULLSCREEN #define HLINE (2.0f / (SCREEN_WIDTH / 4)) @@ -23,6 +24,9 @@ typedef struct{float x; float y;}vec2; #define irand srand #define grand rand +template +int eAmt(T (&)[N]){return N;} + //SDL VARIABLES extern SDL_Window *window; extern SDL_Surface *renderSurface; diff --git a/include/entities.h b/include/entities.h index 752908b..2ed97ee 100644 --- a/include/entities.h +++ b/include/entities.h @@ -3,6 +3,8 @@ #include +extern int npcAmt; + class Entity{ public: float width; @@ -11,10 +13,14 @@ public: int type, subtype; vec2 loc; vec2 vel; - bool right,left; + bool right,left, canMove; + bool alive; void spawn(float, float); void draw(void); + void wander(int, vec2*); +private: + int ticksToUse; }; class Player : public Entity{ @@ -27,8 +33,8 @@ public: NPC(); }; -extern Entity *entnpc[10]; //The NPC base -extern NPC npc[10]; +extern Entity *entnpc[32]; //The NPC base +extern NPC npc[32]; class Structures : public Entity{ public: -- cgit v1.2.3