Decoration.

This commit is contained in:
Steve 2018-01-27 08:08:17 +00:00
parent 8e7f53ea54
commit 1b426ec9d3
6 changed files with 185 additions and 2 deletions

View File

@ -14,6 +14,7 @@ SEARCHPATH += src/world/entities
SEARCHPATH += src/world/entities/blobs SEARCHPATH += src/world/entities/blobs
SEARCHPATH += src/world/entities/boss SEARCHPATH += src/world/entities/boss
SEARCHPATH += src/world/entities/cannons SEARCHPATH += src/world/entities/cannons
SEARCHPATH += src/world/entities/decoration
SEARCHPATH += src/world/entities/items SEARCHPATH += src/world/entities/items
vpath %.c $(SEARCHPATH) vpath %.c $(SEARCHPATH)
@ -24,9 +25,9 @@ DEPS += defs.h structs.h
OBJS += atlas.o OBJS += atlas.o
OBJS += battery.o blaze.o bob.o boss.o blobBoss.o OBJS += battery.o blaze.o bob.o boss.o blobBoss.o
OBJS += camera.o cannon.o cell.o cherry.o combat.o consumable.o OBJS += camera.o cannon.o cell.o cherry.o combat.o consumable.o
OBJS += draw.o OBJS += debris.o draw.o
OBJS += effects.o entities.o explosions.o eyeDroidCommander.o OBJS += effects.o entities.o explosions.o eyeDroidCommander.o
OBJS += frost.o OBJS += fleshChunk.o frost.o
OBJS += game.o OBJS += game.o
OBJS += heart.o hub.o hud.o OBJS += heart.o hub.o hud.o
OBJS += init.o input.o io.o item.o items.o OBJS += init.o input.o io.o item.o items.o

View File

@ -109,6 +109,8 @@ struct Entity {
int ty; int ty;
int reload; int reload;
int isOnGround; int isOnGround;
int effectType;
int bleedTime;
int facing; int facing;
int damage; int damage;
int weaponType; int weaponType;

View File

@ -0,0 +1,65 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "debris.h"
static void tick(void);
static void action(void);
static void touch(Entity *other);
void initDebris(Entity *e)
{
initEntity(e);
e->effectType = rand() % 2;
e->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT;
e->tick = tick;
e->action = action;
e->touch = touch;
}
static void tick(void)
{
self->health--;
}
static void action(void)
{
if (self->effectType == 0)
{
addFlameParticles(self->x + (rand() % self->w), self->y + (rand() % self->h));
}
else
{
addSmokeParticles(self->x + (rand() % self->w), self->y + (rand() % self->h));
}
self->thinkTime = 1;
}
static void touch(Entity *other)
{
if (other == NULL)
{
self->dx *= 0.9;
}
}

View File

@ -0,0 +1,27 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../../../common.h"
extern void initEntity(Entity *e);
extern void addFlameParticles(float x, float y);
extern void addSmokeParticles(float x, float y);
extern Entity *self;

View File

@ -0,0 +1,62 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "fleshChunk.h"
static void tick(void);
static void action(void);
static void touch(Entity *other);
void initFleshChunk(Entity *e)
{
initEntity(e);
e->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT;
e->bleedTime = FPS * 3;
e->tick = tick;
e->action = action;
e->touch = touch;
}
static void tick(void)
{
self->health--;
self->bleedTime--;
}
static void action(void)
{
if (self->bleedTime > 0)
{
addBlood(self->x + (rand() % self->w), self->y + (rand() % self->h));
}
self->thinkTime = 1;
}
static void touch(Entity *other)
{
if (other == NULL)
{
self->dx *= 0.9;
}
}

View File

@ -0,0 +1,26 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../../../common.h"
extern void initEntity(Entity *e);
extern void addBlood(float x, float y);
extern Entity *self;