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