-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ml
97 lines (81 loc) · 1.54 KB
/
types.ml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
type id = int
type enemy_type = Random | Blind | Coop | Boss
type direction = North | South | East | West
type player_action =
| Stand
| Step
| Attack
type sprite_type = Enemy of enemy_type | Player
type move =
{
id: string;
unlocked: bool;
frame: int;
}
type location =
{
coordinate: float * float;
room: string;
}
type frame_params =
{
img: string;
frame_size: float * float;
offset: float * float;
}
type total_health = float
type sprite =
{
id: int;
name: sprite_type;
action: player_action;
mutable size: (float*float);
speed: float;
location: location;
health: float * total_health;
kill_count: int;
direction: direction;
moves: move list;
moving: bool;
mutable params: frame_params;
mutable counter: int;
mutable max_count: int;
mutable frame_count: int;
mutable max_frame: int;
image: string;
has_won: bool
}
type portal =
{
location: location;
teleport_to: location;
}
type obj =
| Portal of portal
| Texture of location
| Obstacle of location
| End of location
type room =
{
room_id: string;
width: float;
height: float;
obj_lst: obj list;
}
type state =
{
all_sprites: sprite list;
mutable has_won: bool;
all_rooms: room list;
mutable current_room_id: string;
attack: (float * float) * location
}
type command = {
mutable w : bool;
mutable a : bool;
mutable s : bool;
mutable d : bool;
mutable j : bool;
mutable k : bool;
mutable l : bool;
}