Init debris and flesh chunks.

This commit is contained in:
Steve 2018-02-05 08:37:54 +00:00
parent d10356c42c
commit 20404fd6eb
4 changed files with 11 additions and 14 deletions

View File

@ -24,11 +24,9 @@ static void tick(void);
static void action(void);
static void touch(Entity *other);
void initDebris(Entity *e)
void initDebris(Decoration *d)
{
Decoration *d;
initEntity(e);
initEntity((Entity*)d);
d = (Decoration*)self;

View File

@ -24,13 +24,9 @@ static void tick(void);
static void action(void);
static void touch(Entity *other);
void initFleshChunk(Entity *e)
void initFleshChunk(Decoration *d)
{
Decoration *d;
initEntity(e);
d = (Decoration*)e;
initEntity((Entity*)d);
d->type = ET_DECORATION;

View File

@ -44,8 +44,7 @@ void addSmallFleshChunk(float x, float y)
chunk = malloc(sizeof(Decoration));
memset(chunk, 0, sizeof(Decoration));
world.entityTail->next = (Entity*)chunk;
world.entityTail = (Entity*)chunk;
initFleshChunk(chunk);
chunk->x = x;
chunk->y = y;
@ -53,6 +52,8 @@ void addSmallFleshChunk(float x, float y)
chunk->dy = 0;
chunk->health = FPS / 4;
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[0];
chunk->spriteFrame = 0;
}
void throwFleshChunks(float x, float y, int amount)
@ -64,8 +65,7 @@ void throwFleshChunks(float x, float y, int amount)
{
chunk = malloc(sizeof(Decoration));
memset(chunk, 0, sizeof(Decoration));
world.entityTail->next = (Entity*)chunk;
world.entityTail = (Entity*)chunk;
initFleshChunk(chunk);
chunk->x = x;
chunk->y = y;
@ -73,6 +73,8 @@ void throwFleshChunks(float x, float y, int amount)
chunk->dy = -rrnd(10, 15);
chunk->health = FPS * rrnd(3, 12);
chunk->sprite[0] = chunk->sprite[1] = chunk->sprite[2] = fleshChunk[i % 3];
chunk->spriteFrame = 0;
}
}

View File

@ -22,5 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int rrnd(int low, int high);
extern Sprite *getSprite(char *name);
extern void initFleshChunk(Decoration *d);
extern World world;