Tweaks to missile behaviour, to increase accuracy.
This commit is contained in:
parent
5b7410dc1f
commit
05860ed8ca
|
@ -153,12 +153,9 @@ static void faceTarget(Bullet *b)
|
|||
|
||||
b->angle = mod(b->angle, 360);
|
||||
|
||||
b->dx *= 0.35;
|
||||
b->dy *= 0.35;
|
||||
}
|
||||
else
|
||||
{
|
||||
b->angle = wantedAngle;
|
||||
/* halve your speed while you're not at the correct angle */
|
||||
b->dx *= 0.5;
|
||||
b->dy *= 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,8 +164,8 @@ static void applyMissileThrust(Bullet *b)
|
|||
int maxSpeed;
|
||||
float v, thrust;
|
||||
|
||||
b->dx += sin(TO_RAIDANS(b->angle)) * 0.5;
|
||||
b->dy += -cos(TO_RAIDANS(b->angle)) * 0.5;
|
||||
b->dx += sin(TO_RAIDANS(b->angle));
|
||||
b->dy += -cos(TO_RAIDANS(b->angle));
|
||||
|
||||
maxSpeed = MAX(MIN(b->target->speed + 1, 999), 3);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../json/cJSON.h"
|
||||
|
||||
#define TURN_SPEED 2
|
||||
#define TURN_THRESHOLD 8
|
||||
#define TURN_THRESHOLD 3
|
||||
|
||||
extern SDL_Texture *getTexture(char *filename);
|
||||
extern void blitRotated(SDL_Texture *texture, int x, int y, int angle);
|
||||
|
|
Loading…
Reference in New Issue