add 'animTimer' to player type, to help decide which frame to show for player
This commit is contained in:
@@ -51,6 +51,7 @@ struct
|
|||||||
, charge = Constants.maxCharge
|
, charge = Constants.maxCharge
|
||||||
, projectiles = Vector.fromList []
|
, projectiles = Vector.fromList []
|
||||||
, platID = ~1
|
, platID = ~1
|
||||||
|
, animTimer = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
val wall1 = {id = 1, x = 0, y = 0, width = 100, height = 1080}
|
val wall1 = {id = 1, x = 0, y = 0, width = 100, height = 1080}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ sig
|
|||||||
| W_CHARGE of int
|
| W_CHARGE of int
|
||||||
| W_PROJECTILES of PlayerType.player_projectile vector
|
| W_PROJECTILES of PlayerType.player_projectile vector
|
||||||
| W_PLAT_ID of int
|
| W_PLAT_ID of int
|
||||||
|
| W_ANIM_TIMER of int
|
||||||
|
|
||||||
val withPatch: PlayerType.player * player_patch -> PlayerType.player
|
val withPatch: PlayerType.player * player_patch -> PlayerType.player
|
||||||
val withPatches: PlayerType.player * player_patch list -> PlayerType.player
|
val withPatches: PlayerType.player * player_patch list -> PlayerType.player
|
||||||
@@ -39,6 +40,7 @@ struct
|
|||||||
| W_CHARGE of int
|
| W_CHARGE of int
|
||||||
| W_PROJECTILES of PlayerType.player_projectile vector
|
| W_PROJECTILES of PlayerType.player_projectile vector
|
||||||
| W_PLAT_ID of int
|
| W_PLAT_ID of int
|
||||||
|
| W_ANIM_TIMER of int
|
||||||
|
|
||||||
fun mkPlayer
|
fun mkPlayer
|
||||||
( health
|
( health
|
||||||
@@ -56,6 +58,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
) =
|
) =
|
||||||
{ yAxis = yAxis
|
{ yAxis = yAxis
|
||||||
, xAxis = xAxis
|
, xAxis = xAxis
|
||||||
@@ -72,6 +75,7 @@ struct
|
|||||||
, charge = charge
|
, charge = charge
|
||||||
, projectiles = projectiles
|
, projectiles = projectiles
|
||||||
, platID = platID
|
, platID = platID
|
||||||
|
, animTimer = animTimer
|
||||||
}
|
}
|
||||||
|
|
||||||
fun withPatch (player, patch) =
|
fun withPatch (player, patch) =
|
||||||
@@ -92,6 +96,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
} = player
|
} = player
|
||||||
in
|
in
|
||||||
case patch of
|
case patch of
|
||||||
@@ -112,6 +117,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_Y_AXIS yAxis =>
|
| W_Y_AXIS yAxis =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -130,6 +136,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_RECOIL recoil =>
|
| W_RECOIL recoil =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -148,6 +155,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_ATTACKED attacked =>
|
| W_ATTACKED attacked =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -166,6 +174,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_MAIN_ATTACK mainAttack =>
|
| W_MAIN_ATTACK mainAttack =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -184,6 +193,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_FACING facing =>
|
| W_FACING facing =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -202,6 +212,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_HEALTH health =>
|
| W_HEALTH health =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -220,6 +231,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_X x =>
|
| W_X x =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -238,6 +250,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_Y y =>
|
| W_Y y =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -256,6 +269,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_JUMP_PRESSED jumpPressed =>
|
| W_JUMP_PRESSED jumpPressed =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -274,6 +288,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_MAIN_ATTACK_PRESSED mainAttackPressed =>
|
| W_MAIN_ATTACK_PRESSED mainAttackPressed =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -292,6 +307,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_ENEMIES enemies =>
|
| W_ENEMIES enemies =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -310,6 +326,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_CHARGE charge =>
|
| W_CHARGE charge =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -328,6 +345,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_PROJECTILES projectiles =>
|
| W_PROJECTILES projectiles =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -346,6 +364,7 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
| W_PLAT_ID platID =>
|
| W_PLAT_ID platID =>
|
||||||
mkPlayer
|
mkPlayer
|
||||||
@@ -364,6 +383,26 @@ struct
|
|||||||
, charge
|
, charge
|
||||||
, projectiles
|
, projectiles
|
||||||
, platID
|
, platID
|
||||||
|
, animTimer
|
||||||
|
)
|
||||||
|
| W_ANIM_TIMER animTimer =>
|
||||||
|
mkPlayer
|
||||||
|
( health
|
||||||
|
, xAxis
|
||||||
|
, yAxis
|
||||||
|
, x
|
||||||
|
, y
|
||||||
|
, jumpPressed
|
||||||
|
, recoil
|
||||||
|
, attacked
|
||||||
|
, mainAttack
|
||||||
|
, facing
|
||||||
|
, mainAttackPressed
|
||||||
|
, enemies
|
||||||
|
, charge
|
||||||
|
, projectiles
|
||||||
|
, platID
|
||||||
|
, animTimer
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -29,5 +29,6 @@ struct
|
|||||||
, charge: int
|
, charge: int
|
||||||
, projectiles: player_projectile vector
|
, projectiles: player_projectile vector
|
||||||
, platID: int
|
, platID: int
|
||||||
|
, animTimer: int
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user