aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-12-14 08:25:15 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-12-14 08:25:15 -0500
commitc5050b17d16670c6151d5c135c3b01d66b7530f9 (patch)
treed8cffed7b2a576023e013b2133504d273e85b652 /src/entities.cpp
parentb477db406b9d7aa4f62a750c9ae3c3cedc533b3b (diff)
Added particles
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index a04b638..1fefa9a 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -10,6 +10,8 @@ extern Player *player;
extern const char *itemName;
+extern
+
void getRandomName(Entity *e){
int tempNum,max=0;
char *bufs;
@@ -57,6 +59,7 @@ void Entity::spawn(float x, float y){ //spawns the entity you pass to it based o
near = false;
canMove = true;
ground = false;
+ hit = false;
ticksToUse = 0;
@@ -116,12 +119,12 @@ NPC::~NPC(){
}
Structures::Structures(){ //sets the structure type
- health = maxHealth = 1;
+ health = maxHealth = 25;
alive = false;
near = false;
- tex = new Texturec(1,"assets/house1.png");
+ tex = new Texturec(3,"assets/house1.png", "assets/house2.png", "assets/fountain1.png");
inWorld = NULL;
name = NULL;
@@ -211,6 +214,7 @@ void Entity::draw(void){ //draws the entities
static int texState = 0;
static bool up = true;
if(loops % (int)((float)4/(float)speed) == 0){
+ //currentWorld->addParticle(loc.x,loc.y-HLINE,HLINE,HLINE,0,0,{0.0f,.17f,0.0f},1000);
if(up){
if(++texState==2)up=false;
tex->bindNext();
@@ -241,6 +245,19 @@ void Entity::draw(void){ //draws the entities
break;
}
break;
+ case STRUCTURET:
+ for(auto &strt : currentWorld->build){
+ if(this == strt){
+ if(strt->bsubtype == HOUSE){
+ tex->bind(0);
+ }else if(strt->bsubtype == HOUSE2){
+ tex->bind(1);
+ }else if(strt->bsubtype == FOUNTAIN){
+ tex->bind(2);
+ }
+ }
+ }
+ break;
default:
tex->bind(0);
break;
@@ -369,7 +386,7 @@ void Object::interact(void){
* point to have non-normal traits so it could be invisible or invincible...
*/
-unsigned int Structures::spawn(_TYPE t, float x, float y){
+unsigned int Structures::spawn(_TYPE t, BUILD_SUB sub, float x, float y){
loc.x = x;
loc.y = y;
type = t;
@@ -378,6 +395,7 @@ unsigned int Structures::spawn(_TYPE t, float x, float y){
width = 50 * HLINE;
height = 40 * HLINE;
+ bsubtype = sub;
/*
* tempN is the amount of entities that will be spawned in the village. Currently the village