Added jump effects (sound and graphics).
This commit is contained in:
parent
b5fc0aacbd
commit
b99dd3a4e4
|
@ -14,11 +14,11 @@ GRAPHICS
|
|||
|
||||
gfx/planets/earth.png - modified from the the Blue Marble NASA photograph: http://visibleearth.nasa.gov/view.php?id=57723
|
||||
|
||||
All other graphics are CC BY-NC-SA 3.0, with the following attribution: Copyright 2015, Stephen J Sweeney | www.battleforthesolarsystem.com
|
||||
All other graphics are CC BY-NC-SA 3.0, with the following attribution: Copyright 2015,2016, Stephen J Sweeney | www.battleforthesolarsystem.com
|
||||
|
||||
DATA FILES (with the exception of Roboto font)
|
||||
|
||||
CC BY-NC-SA 3.0, with the following attribution: Copyright 2015, Stephen J Sweeney | www.battleforthesolarsystem.com
|
||||
CC BY-NC-SA 3.0, with the following attribution: Copyright 2015,2016, Stephen J Sweeney | www.battleforthesolarsystem.com
|
||||
|
||||
SOUND
|
||||
|
||||
|
@ -45,6 +45,7 @@ SOUND
|
|||
321104__nsstudios__blip2.ogg - blip2, by nsstudios - https://freesound.org/people/nsstudios/sounds/321104/
|
||||
321906__bruce965__walkie-talkie-roger-beep.ogg - Walkie Talkie - Roger Beep, by bruce965 - https://freesound.org/people/bruce965/sounds/321906/
|
||||
322603__clippysounds__glass-break.ogg - Glass Break, by clippysounds - https://freesound.org/people/clippysounds/sounds/322603/
|
||||
276912__pauldihor__transform.ogg - transform, by PaulDihor - https://freesound.org/people/PaulDihor/sounds/276912/
|
||||
|
||||
|
||||
MUSIC
|
||||
|
|
Binary file not shown.
|
@ -44,15 +44,14 @@ void doEffects(void)
|
|||
e->x += e->dx;
|
||||
e->y += e->dy;
|
||||
|
||||
e->a -= (e->type != EFFECT_ECM) ? 1 : 3;
|
||||
e->a = MAX(0, e->a);
|
||||
|
||||
e->health--;
|
||||
|
||||
e->size += e->scaleAmount;
|
||||
|
||||
if (e->health <= 0)
|
||||
{
|
||||
e->a -= (e->type != EFFECT_ECM) ? 1 : 3;
|
||||
|
||||
if (e->a <= 0)
|
||||
{
|
||||
if (e == battle.effectTail)
|
||||
{
|
||||
|
@ -63,7 +62,6 @@ void doEffects(void)
|
|||
free(e);
|
||||
e = prev;
|
||||
}
|
||||
}
|
||||
|
||||
prev = e;
|
||||
}
|
||||
|
@ -84,6 +82,10 @@ void drawEffects(void)
|
|||
|
||||
switch (e->type)
|
||||
{
|
||||
case EFFECT_POINT:
|
||||
SDL_RenderDrawPoint(app.renderer, e->x - battle.camera.x, e->y - battle.camera.y);
|
||||
break;
|
||||
|
||||
case EFFECT_LINE:
|
||||
SDL_RenderDrawLine(app.renderer, e->x - battle.camera.x, e->y - battle.camera.y, e->x + (e->dx * 3) - battle.camera.x, e->y + (e->dy * 3) - battle.camera.y);
|
||||
break;
|
||||
|
@ -129,12 +131,12 @@ void addSmallFighterExplosion(void)
|
|||
e->x = self->x + (rand() % 16 - rand() % 16);
|
||||
e->y = self->y + (rand() % 16 - rand() % 16);
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 32;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -154,12 +156,12 @@ void addDebrisFire(int x, int y)
|
|||
e->x = x + (rand() % 8 - rand() % 8);
|
||||
e->y = y + (rand() % 8 - rand() % 8);
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 4 + rand() % 12;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = rand() % 256;
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -186,13 +188,13 @@ void addSmallExplosion(void)
|
|||
e->dy = (rand() % 25) - (rand() % 25);
|
||||
e->dy *= 0.025;
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 32 + (rand() % 64);
|
||||
e->r = 255;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -212,9 +214,9 @@ void addSmallExplosion(void)
|
|||
e->dx *= 0.1;
|
||||
e->dy = rand() % 64 - rand() % 64;
|
||||
e->dy *= 0.1;
|
||||
e->health = FPS / 2;
|
||||
|
||||
e->a = 128;
|
||||
e->health = e->a;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
}
|
||||
|
@ -241,13 +243,13 @@ void addMissileExplosion(Bullet *b)
|
|||
e->dy = (rand() % 25) - (rand() % 25);
|
||||
e->dy *= 0.025;
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 32 + (rand() % 64);
|
||||
e->r = 255;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -267,9 +269,9 @@ void addMissileExplosion(Bullet *b)
|
|||
e->dx *= 0.1;
|
||||
e->dy = rand() % 64 - rand() % 64;
|
||||
e->dy *= 0.1;
|
||||
e->health = FPS / 2;
|
||||
|
||||
e->a = 128;
|
||||
e->health = e->a;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
}
|
||||
|
@ -299,13 +301,14 @@ void addEngineEffect(void)
|
|||
e->x += rand() % 4 - rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 16;
|
||||
e->r = 128;
|
||||
e->g = 128;
|
||||
e->b = 255;
|
||||
e->a = 64;
|
||||
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
}
|
||||
|
@ -331,13 +334,14 @@ void addLargeEngineEffect(void)
|
|||
e->x -= rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 64;
|
||||
e->r = 128;
|
||||
e->g = 128;
|
||||
e->b = 255;
|
||||
e->a = 64;
|
||||
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
}
|
||||
|
@ -363,11 +367,12 @@ void addMissileEngineEffect(Bullet *b)
|
|||
e->x -= rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->health = 0;
|
||||
e->size = 12;
|
||||
setRandomFlameHue(e);
|
||||
e->a = 128;
|
||||
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static void think(void);
|
||||
static void handleFleeingEntities(void);
|
||||
static void addEscapeEffect(Entity *ent);
|
||||
|
||||
Entity *spawnExtractionPoint(void)
|
||||
{
|
||||
|
@ -60,9 +61,44 @@ static void handleFleeingEntities(void)
|
|||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
{
|
||||
if (e->health > 0 && e->flags & EF_RETREATING && getDistance(self->x, self->y, e->x, e->y) <= 64)
|
||||
if (e->health > 0 && e->flags & EF_RETREATING && getDistance(self->x, self->y, e->x, e->y) <= 255)
|
||||
{
|
||||
e->alive = ALIVE_ESCAPED;
|
||||
|
||||
addEscapeEffect(e);
|
||||
|
||||
playSound(SND_JUMP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void addEscapeEffect(Entity *ent)
|
||||
{
|
||||
Effect *e;
|
||||
int i, n, speed;
|
||||
|
||||
n = ent->w * ent->h;
|
||||
|
||||
for (i = 0 ; i < n ; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
battle.effectTail->next = e;
|
||||
battle.effectTail = e;
|
||||
|
||||
speed = 50 + rand() % 50;
|
||||
|
||||
e->type = EFFECT_POINT;
|
||||
e->x = ent->x + (rand() % ent->w) - (rand() % ent->w);
|
||||
e->y = ent->y + (rand() % ent->h) - (rand() % ent->w);
|
||||
|
||||
e->dx = self->x - e->x;
|
||||
e->dx /= speed;
|
||||
|
||||
e->dy = self->y - e->y;
|
||||
e->dy /= speed;
|
||||
|
||||
e->r = e->g = e->b = e->a = (rand() % 255);
|
||||
e->health = speed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ extern SDL_Texture *getTexture(char *filename);
|
|||
extern Entity *spawnEntity(void);
|
||||
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void playSound(int id);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *self;
|
||||
|
|
|
@ -172,6 +172,7 @@ enum
|
|||
|
||||
enum
|
||||
{
|
||||
EFFECT_POINT,
|
||||
EFFECT_LINE,
|
||||
EFFECT_TEXTURE,
|
||||
EFFECT_HALO,
|
||||
|
@ -194,6 +195,7 @@ enum
|
|||
SND_GET_ITEM,
|
||||
SND_MISSILE,
|
||||
SND_INCOMING,
|
||||
SND_JUMP,
|
||||
SND_BOOST,
|
||||
SND_RADIO,
|
||||
SND_GUI_CLICK,
|
||||
|
|
|
@ -107,6 +107,7 @@ static void loadSounds(void)
|
|||
sounds[SND_EXPLOSION_2] = Mix_LoadWAV(getFileLocation("sound/207322__animationisaac__short-explosion.ogg"));
|
||||
sounds[SND_EXPLOSION_3] = Mix_LoadWAV(getFileLocation("sound/254071__tb0y298__firework-explosion.ogg"));
|
||||
sounds[SND_EXPLOSION_4] = Mix_LoadWAV(getFileLocation("sound/47252__nthompson__bad-explosion.ogg"));
|
||||
sounds[SND_JUMP] = Mix_LoadWAV(getFileLocation("sound/276912__pauldihor__transform.ogg"));
|
||||
|
||||
sounds[SND_GUI_CLICK] = Mix_LoadWAV(getFileLocation("sound/257786__xtrgamr__mouse-click.ogg"));
|
||||
sounds[SND_GUI_SELECT] = Mix_LoadWAV(getFileLocation("sound/321104__nsstudios__blip2.ogg"));
|
||||
|
|
Loading…
Reference in New Issue