-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathship.h
More file actions
36 lines (29 loc) · 802 Bytes
/
ship.h
File metadata and controls
36 lines (29 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _SHIP_H_
#define _SHIP_H_
#include "utils.h"
#include "shot.h"
#define INITIAL_VELOCITY 10
#define MOVING_FACTOR 2
#define VELOCITY_FACTOR 10
#define MAX_XY_ORIENTATION 15
#define MAX_VELOCITY 100
#define SHIP_SHOT_VELOCITY 60
typedef struct ship Ship;
struct ship {
int life;
Position position;
Velocity velocity;
Dimension dimension;
};
extern float traveledDistance;
Ship* createShip(Position position);
void killShip(Ship* sh);
void updateVelocity(Ship *sh, Key key);
void updateShipPosition(Ship* sh);
void insideKeeper(Ship *sh, Dimension dimension);
Shot* shootFromShip(Position aimP, Position shipP, int power);
void gotDamagedShip(Ship* sh, int damage);
BOOL isShipAlive(Ship* sh);
void updateScore(Ship* sh);
void renderShip(Ship* sh);
#endif