Missile launching tweaks. Slight delay before start chasing.

This commit is contained in:
Steve 2016-04-26 22:43:25 +01:00
parent dcb0cf8450
commit 1ee41e0993
2 changed files with 10 additions and 2 deletions

View File

@ -93,7 +93,10 @@ void doBullets(void)
{
addMissileEngineEffect(b);
huntTarget(b);
if (b->life < MISSILE_LIFE - (FPS / 2))
{
huntTarget(b);
}
if (b->target == player && player != NULL && player->health > 0)
{
@ -401,8 +404,11 @@ void fireMissile(Entity *owner)
Bullet *b;
b = createBullet(BT_MISSILE, owner->x, owner->y, owner);
b->dx *= 0.5;
b->dy *= 0.5;
b->life = FPS * 30;
b->life = MISSILE_LIFE;
owner->missiles--;

View File

@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TURN_THRESHOLD 3
#define INITIAL_BULLET_DRAW_CAPACITY 32
#define MISSILE_LIFE (FPS * 30)
extern SDL_Texture *getTexture(char *filename);
extern void blitRotated(SDL_Texture *texture, int x, int y, float angle);
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);