Decoration updates.

This commit is contained in:
Steve 2018-02-05 22:06:53 +00:00
parent 8c9ee4f553
commit 683746b239
4 changed files with 21 additions and 11 deletions

View File

@ -34,6 +34,8 @@ void initDebris(Decoration *d)
d->effectType = rand() % 2;
d->spriteFrame = 0;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT;
d->tick = tick;

View File

@ -34,6 +34,8 @@ void initFleshChunk(Decoration *d)
d->bleedTime = FPS * 3;
d->spriteFrame = 0;
d->tick = tick;
d->action = action;
d->touch = touch;

View File

@ -34,10 +34,6 @@ void initEffects(void)
debris[2] = getSprite("Debris3");
}
void addExplosionEffect(int x, int y, float dx, float dy)
{
}
void addSmallFleshChunk(float x, float y)
{
Decoration *chunk;
@ -48,12 +44,8 @@ void addSmallFleshChunk(float x, float y)
chunk->x = x;
chunk->y = y;
chunk->dx = 0;
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)
@ -73,12 +65,25 @@ 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;
}
}
void throwDebris(float x, float y, int amount)
{
int i;
Decoration *piece;
for (i = 0; i < amount; i++)
{
piece = malloc(sizeof(Decoration));
memset(piece, 0, sizeof(Decoration));
initDebris(piece);
piece->x = x;
piece->y = y;
piece->dx = rrnd(-2, 2);
piece->dy = -rrnd(10, 15);
piece->health = FPS * (rand() % 3);
piece->sprite[0] = piece->sprite[1] = piece->sprite[2] = debris[i % 3];
}
}

View File

@ -23,5 +23,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 void initDebris(Decoration *d);
extern World world;