-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameLogic.h
55 lines (39 loc) · 1.01 KB
/
gameLogic.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* gameEngine.h
*
* Created on: 26.06.2017
* Author: Student225988
*/
#ifndef GAMELOGIC_H_
#define GAMELOGIC_H_
#include "graphicsEngine.h"
#define JUMP_TIMEOUT 4
#define BARREL_SPAWN_PROB 30
typedef struct{
int barrelPosition;
int barrelDirection;
int anBarrelFrame;
int inGame;
} Barrel;
typedef struct{
DrawableObject doPlayerStanding;
DrawableObject doPlayerJumping;
DrawableObject doBarrelAnim0;
DrawableObject doBarrelAnim1;
int anGlobalCounter;
int anBarrelFreq;
unsigned playerInAirFlag;
unsigned playerPosition;
unsigned playerHealth;
unsigned playerJumptimeout;
Barrel barrels[2];
int barrelsSize;
int gameOverFlag;
} GameState;
void gameStart(GameState* gs);
void gameInitGraphics(GameState* gs, GraphicsEngine* gEngine);
void gameLoopIteration(GameState* gs);
void onLeftButtonPress(GameState* gs);
void onRightButtonPress(GameState* gs);
void onRedraw(GraphicsEngine* engine, GameState* gs);
#endif /* GAMELOGIC_H_ */