-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameConstants.elm
159 lines (125 loc) · 3.67 KB
/
GameConstants.elm
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{-- type definitions and global constants --}
module GameConstants where
import Random
import Color
{---------------------- type definitions -----------------------------}
type Screen = Active | Menu | Inactive
type alias GameState = { proj : Projectile,
tanks : List Tank,
turn : Int,
screen : Screen,
loser : Maybe Loser,
terrain : List (Float, Float) ,
seed : Random.Seed
}
type alias Tank = { health : Int,
position : Vector2D,
size : (Float, Float),
color : Color.Color,
initVelocity : Vector2D }
type alias Projectile = { position : Vector2D,
velocity : Vector2D,
acceleration : Vector2D,
damage : Int }
type alias Vector2D = { x : Float,
y : Float }
type alias Input = { power : Int,
angle : Int,
space : Bool,
restart: Bool,
enter : Bool }
type alias Loser = Int
{---------------------- initial state values -----------------------------}
initState : GameState
initState = { proj = initProj,
tanks = [tank1, tank2],
turn = 0,
screen = Menu,
loser = Nothing,
terrain = default,
seed = Random.initialSeed 46837967489
}
initProj : Projectile
initProj = { acceleration = gravity,
damage = dmg,
position = tank1.position,
velocity = tank1.initVelocity}
tank1 : Tank
tank1 = { health = 100,
position = { x = -350 , y = 100},
size = (20, 8),
color = ourYellow,
initVelocity = {x = 10, y = 8}}
tank2 : Tank
tank2 = { health = 100,
position = {x = 350, y = 100},
size = (20, 8),
color = ourBlue,
initVelocity = {x = -10, y = 8}}
{---------------------- global constants -----------------------------}
darkGrey : Color.Color
darkGrey = Color.rgb 103 112 119
lightGrey : Color.Color
lightGrey = Color.rgb 181 181 183
ourBlue : Color.Color
ourBlue = Color.rgb 37 40 57
ourYellow : Color.Color
ourYellow = Color.rgb 242 182 50
hitRadius : Float
hitRadius = 20.0
dmg : Int
dmg = 50
gravity: Vector2D
gravity = {x=0, y=-1}
{---------------------- terrain -----------------------------}
terrainMaps = [cliff, default, fort, hill]
default: List (Float, Float)
default = [(-1000, 0), (-500, -35), (-234, 56), (-30, 16), (0, -20), (50, 34), (250, -10), (400, -75), (1000, 0)]
hill: List (Float, Float)
hill = [(-1000, 0),
(-500, -100),
(-450, -90),
(-400, -75),
(-325, -80),
(-300, -60),
(-200, -10),
(-150, 10),
(-100, 30),
(-25, 45),
(0, 50),
(25, 45),
(100, 30),
(150, 10),
(200, -10),
(300, -60),
(325,-80),
(400,-75),
(450,-90),
(500,-100),
(1000,0)]
cliff: List (Float, Float)
cliff = [(-1000, 100),
(-500, 200),
(-450, 255),
(-400, 252),
(-350, 255),
(-300, 251),
(-250, 250),
(-200, 0),
(0, 10),
(300, 0),
(1000, -10)]
fort: List (Float, Float)
fort = [(-1000, 0),
(-500, 10),
(-425, 20),
(-200, 10),
(-100, -20),
(-25, 0),
(-20, 200),
(20, 200),
(20, 25),
(30, -30),
(50, -40),
(200, -5),
(1000, 0)]