#include <SDL2/SDL_opengl.h>
typedef struct { float x; float y; }vec2;
-typedef struct { char* first; char* last; }_name;
enum _TYPE { //these are the main types of entities
STRUCTURET = -1,
NPCT = 1
};
+enum GENDER{
+ MALE,
+ FEMALE,
+ NONE
+};
+
#include <entities.h>
#define SCREEN_WIDTH 1280
extern bool gameRunning;
extern unsigned int deltaTime;
+extern FILE* config;
+extern FILE* names;
+
#endif // COMMON_H
unsigned char ground; //variable for testing what ground the entity is on to apply certain traits
unsigned int texture[]; //TODO: ADD TEXTURES
+
void spawn(float, float);
void draw(void);
void wander(int, vec2*);
+ char* getName();
virtual void interact(){}
private:
int ticksToUse; //The variable for deciding how long an entity should do a certain task
ticksToUse--; //removes one off of the entities timer
}
+char* Entity::getName(){
+ char* buf;
+
+ return buf;
+}
+
Player::Player(){ //sets all of the player specific traits on object creation
width = HLINE * 8;
height = HLINE * 12;
std::vector<Structures>build;
int mx, my;
-
-FILE* config;
FILE* names;
void logic();
// WORLD GENERATION STUFF //
//************************************************************************//
+ names = fopen("assets/names_en-us", "r+");
// Make a world
World *test=new World();
test->generate(SCREEN_WIDTH/2);
//************************************************************************//
// END WORLD GENERATION STUFF //
//************************************************************************//
-
currentTime=millis();
while(gameRunning){
prevTime = currentTime;
for(int i=0;i<=entity.size();i++){
if(entity[i]->alive&&entity[i]->type == NPCT){
entity[i]->wander((rand()%120 + 30), &entity[i]->vel);
- if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(35*HLINE,2)){
+ if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(40*HLINE,2)){
if(mx >= entity[i]->loc.x && mx <= entity[i]->loc.x + entity[i]->width && my >= entity[i]->loc.y && my <= entity[i]->loc.y + entity[i]->width
&& (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)))
entity[i]->interact();