Allow enemies to fire missiles.
This commit is contained in:
parent
c506ad32cf
commit
aaf58614f4
|
@ -17,5 +17,9 @@
|
|||
"x" : 8,
|
||||
"y" : 0
|
||||
}
|
||||
]
|
||||
],
|
||||
"missiles" : {
|
||||
"type" : "MISSILE_MISSILE",
|
||||
"ammo" : 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,5 +17,9 @@
|
|||
"x" : 8,
|
||||
"y" : 0
|
||||
}
|
||||
]
|
||||
],
|
||||
"missiles" : {
|
||||
"type" : "MISSILE_MISSILE",
|
||||
"ammo" : 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,9 +287,16 @@ static int hasClearShot(void)
|
|||
|
||||
static void preAttack(void)
|
||||
{
|
||||
if (!self->reload && self->guns[0].type)
|
||||
if (!self->reload)
|
||||
{
|
||||
fireGuns(self);
|
||||
if (self->missiles.ammo == 0 || (rand() % 50) > 0)
|
||||
{
|
||||
fireGuns(self);
|
||||
}
|
||||
else
|
||||
{
|
||||
fireMissile(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern int mod(int n, int x);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void fireGuns(Entity *owner);
|
||||
extern void fireMissile(Entity *owner);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern void applyFighterThrust(void);
|
||||
extern void applyFighterBrakes(void);
|
||||
|
|
|
@ -104,6 +104,8 @@ static void randomizeDart(Entity *dart)
|
|||
|
||||
randomizeDartGuns(dart);
|
||||
|
||||
dart->missiles.ammo = rand() % 3;
|
||||
|
||||
sprintf(textureName, "gfx/fighters/dart0%d.png", 1 + rand() % 7);
|
||||
|
||||
dart->texture = getTexture(textureName);
|
||||
|
|
Loading…
Reference in New Issue