Bug fix for engine position.

This commit is contained in:
Steve 2015-12-24 11:54:01 +00:00
parent ff953cf0e7
commit 5075adc0b4
1 changed files with 9 additions and 6 deletions

View File

@ -278,6 +278,8 @@ void addMissileExplosion(Bullet *b)
void addEngineEffect(void) void addEngineEffect(void)
{ {
Effect *e; Effect *e;
float c, s;
int h;
e = malloc(sizeof(Effect)); e = malloc(sizeof(Effect));
memset(e, 0, sizeof(Effect)); memset(e, 0, sizeof(Effect));
@ -286,14 +288,15 @@ void addEngineEffect(void)
e->type = EFFECT_TEXTURE; e->type = EFFECT_TEXTURE;
e->x = self->x; s = sin(TO_RAIDANS(self->angle));
e->y = self->y; c = cos(TO_RAIDANS(self->angle));
e->x -= sin(TO_RAIDANS(self->angle)) * 16; h = self->h / 2;
e->y -= -cos(TO_RAIDANS(self->angle)) * 16;
e->x += rand() % 4; e->x = -(h * s) + self->x;
e->x -= rand() % 4; e->y = (h * c) + self->y;
e->x += rand() % 4 - rand() % 4;
e->texture = explosionTexture; e->texture = explosionTexture;
e->health = 0; e->health = 0;