add 'enemies' field to player type
This commit is contained in:
@@ -21,6 +21,8 @@ sig
|
||||
|
||||
datatype main_attack = MAIN_NOT_ATTACKING | MAIN_ATTACKING of int
|
||||
|
||||
type defeated_enemies = {x: int, y: int}
|
||||
|
||||
type player =
|
||||
{ yAxis: player_y_axis
|
||||
, xAxis: player_x_axis
|
||||
@@ -33,6 +35,7 @@ sig
|
||||
, x: int
|
||||
, y: int
|
||||
, jumpPressed: bool
|
||||
, enemies: defeated_enemies vector
|
||||
}
|
||||
|
||||
datatype player_patch =
|
||||
@@ -47,6 +50,7 @@ sig
|
||||
| W_Y of int
|
||||
| W_JUMP_PRESSED of bool
|
||||
| W_MAIN_ATTACK_PRESSED of bool
|
||||
| W_ENEMIES of defeated_enemies vector
|
||||
|
||||
type enemy = {id: int, health: int, x: int, y: int}
|
||||
|
||||
@@ -87,6 +91,8 @@ struct
|
||||
|
||||
datatype main_attack = MAIN_NOT_ATTACKING | MAIN_ATTACKING of int
|
||||
|
||||
type defeated_enemies = {x: int, y: int}
|
||||
|
||||
type player =
|
||||
{ yAxis: player_y_axis
|
||||
, xAxis: player_x_axis
|
||||
@@ -99,6 +105,7 @@ struct
|
||||
, x: int
|
||||
, y: int
|
||||
, jumpPressed: bool
|
||||
, enemies: defeated_enemies vector
|
||||
}
|
||||
|
||||
datatype player_patch =
|
||||
@@ -113,6 +120,7 @@ struct
|
||||
| W_Y of int
|
||||
| W_JUMP_PRESSED of bool
|
||||
| W_MAIN_ATTACK_PRESSED of bool
|
||||
| W_ENEMIES of defeated_enemies vector
|
||||
|
||||
type enemy = {id: int, health: int, x: int, y: int}
|
||||
|
||||
@@ -140,6 +148,7 @@ struct
|
||||
, x = 500
|
||||
, y = 500
|
||||
, jumpPressed = false
|
||||
, enemies = Vector.fromList []
|
||||
}
|
||||
|
||||
val wall1 = {id = 1, x = 0, y = 0, width = 100, height = 1080}
|
||||
|
||||
@@ -14,6 +14,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
) =
|
||||
{ yAxis = yAxis
|
||||
, xAxis = xAxis
|
||||
@@ -26,6 +27,7 @@ struct
|
||||
, x = x
|
||||
, y = y
|
||||
, jumpPressed = jumpPressed
|
||||
, enemies = enemies
|
||||
}
|
||||
|
||||
fun withPatch (player: player, patch) =
|
||||
@@ -42,6 +44,7 @@ struct
|
||||
, x
|
||||
, y
|
||||
, jumpPressed
|
||||
, enemies
|
||||
} = player
|
||||
in
|
||||
case patch of
|
||||
@@ -58,6 +61,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_Y_AXIS yAxis =>
|
||||
mkPlayer
|
||||
@@ -72,6 +76,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_RECOIL recoil =>
|
||||
mkPlayer
|
||||
@@ -86,6 +91,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_ATTACKED attacked =>
|
||||
mkPlayer
|
||||
@@ -100,6 +106,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_MAIN_ATTACK mainAttack =>
|
||||
mkPlayer
|
||||
@@ -114,6 +121,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_FACING facing =>
|
||||
mkPlayer
|
||||
@@ -128,6 +136,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_HEALTH health =>
|
||||
mkPlayer
|
||||
@@ -142,6 +151,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_X x =>
|
||||
mkPlayer
|
||||
@@ -156,6 +166,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_Y y =>
|
||||
mkPlayer
|
||||
@@ -170,6 +181,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_JUMP_PRESSED jumpPressed =>
|
||||
mkPlayer
|
||||
@@ -184,6 +196,7 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_MAIN_ATTACK_PRESSED mainAttackPressed =>
|
||||
mkPlayer
|
||||
@@ -198,6 +211,22 @@ struct
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
| W_ENEMIES enemies =>
|
||||
mkPlayer
|
||||
( health
|
||||
, xAxis
|
||||
, yAxis
|
||||
, x
|
||||
, y
|
||||
, jumpPressed
|
||||
, recoil
|
||||
, attacked
|
||||
, mainAttack
|
||||
, facing
|
||||
, mainAttackPressed
|
||||
, enemies
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user