Created
April 26, 2017 16:19
-
-
Save Jakemangan/6c3788a46825a86cd0e2642864fcad68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//exposes the parts of the model needed elsewhere. Such as the fire function called by the controller. | |
#include <math.h> | |
#define PI 3.14159265358979323846 | |
typedef struct particle{ | |
float x; | |
float y; | |
float vx; | |
float vy; | |
float heading; | |
float dur; | |
int size; | |
int draw; | |
struct particle *next; | |
} node_t; | |
static float thrustMax = 2; | |
static float thrustInc = 0.2; | |
static float friction = 0.99; | |
const float Dt = 0.025; | |
void physics(void); | |
void initGamestate(void); | |
void updateShipBorder(void); | |
void updateShipLocation(void); | |
void testGameBorders(void); | |
void incHeading(void); | |
void decHeading(void); | |
void rotateShip(void); | |
void addThrust(void); | |
void applyFriction(void); | |
float calcMissileVx(void); | |
float calcMissileVy(void); | |
float calcAstRandX(void); | |
float calcAstRandY(void); | |
float calcAstRandVx(float heading); | |
float calcAstRandVy(float heading); | |
float calcAstRandHeading(void); | |
int calcAstRandSize(void); | |
void checkMissileAsteroidCollision(struct particle *ast, struct particle *mis); | |
float toRads(float heading); | |
//getters | |
float getHeading(void); | |
float getHeadingRads(void); | |
float getShipX(void); | |
float getShipY(void); | |
float getShipX1(void); | |
float getShipY1(void); | |
float getShipX2(void); | |
float getShipY2(void); | |
float getShipX3(void); | |
float getShipY3(void); | |
float getShipVy(void); | |
float getShipVx(void); | |
struct particle* getMissileList(void); | |
struct particle* getAsteroidList(void); | |
int getCollisionCounter(void); | |
//particle system functions - missiles | |
void newMissile(void); | |
void initMissile(struct particle *m); | |
void updateMissiles(struct particle *l); | |
//particle system functions - asteroids | |
void updateAsteroids(struct particle *l); | |
void initAsteroid(struct particle *a); | |
void newAsteroid(void); | |
void initAsteroidProperties(struct particle *a); | |
//node functions - missiles | |
void initialise_heapM(void); | |
node_t *allocnodeM(void); | |
void freenodeM(node_t *n); | |
//node functions - asteroids | |
void initialise_heapA(void); | |
node_t *allocnodeA(void); | |
void freenodeA(node_t *n); | |
void asteroidTick(void); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment