don't make 'falling' enemies come back down (fall), but lift them up instead, filtered when reaching beyond the top of the world. It's a little more fluid with current physics for enemies to be 'spirited away' rather than fall.
This commit is contained in:
@@ -425,7 +425,7 @@ struct
|
||||
* fallingEnemies *)
|
||||
let
|
||||
val fallingList =
|
||||
{x = x, y = y, variant = #variant enemy, jumped = 0} :: fallingList
|
||||
{x = x, y = y, variant = #variant enemy} :: fallingList
|
||||
in
|
||||
(enemyList, fallingList)
|
||||
end
|
||||
@@ -472,7 +472,7 @@ struct
|
||||
* fallingEnemies *)
|
||||
let
|
||||
val fallingList =
|
||||
{x = x, y = y, variant = #variant enemy, jumped = 0} :: fallingList
|
||||
{x = x, y = y, variant = #variant enemy} :: fallingList
|
||||
in
|
||||
(enemyList, fallingList)
|
||||
end
|
||||
|
||||
@@ -49,7 +49,7 @@ struct
|
||||
acc
|
||||
else
|
||||
let
|
||||
val {x, y, jumped, variant} = Vector.sub (vec, pos)
|
||||
val {x, y, variant} = Vector.sub (vec, pos)
|
||||
|
||||
val size = Constants.enemySize
|
||||
val ww = Constants.worldWidth
|
||||
@@ -59,21 +59,10 @@ struct
|
||||
(* filter out if player is attacking falling enemy *)
|
||||
updateList (pos - 1, vec, player, acc)
|
||||
else if Collision.isCollidingPlus (x, y, size, size, 0, 0, ww, wh) then
|
||||
(* move falling enemy up or down depending on jumped *)
|
||||
(* move falling enemy upwards *)
|
||||
let
|
||||
val updated =
|
||||
if jumped < Constants.jumpLimit then
|
||||
{ x = x
|
||||
, y = y - Constants.moveEnemyBy
|
||||
, jumped = jumped + Constants.moveEnemyBy
|
||||
, variant = variant
|
||||
}
|
||||
else
|
||||
{ x = x
|
||||
, y = y + Constants.moveEnemyBy
|
||||
, jumped = jumped
|
||||
, variant = variant
|
||||
}
|
||||
{x = x, y = y - Constants.moveEnemyBy, variant = variant}
|
||||
in
|
||||
updateList (pos - 1, vec, player, updated :: acc)
|
||||
end
|
||||
@@ -89,7 +78,7 @@ struct
|
||||
Vector.concat acc
|
||||
else
|
||||
let
|
||||
val {x, y, variant = _, jumped = _} = Vector.sub (fallingVec, pos)
|
||||
val {x, y, variant = _} = Vector.sub (fallingVec, pos)
|
||||
|
||||
val x = Real32.fromInt x * ratio + xOffset
|
||||
val y = Real32.fromInt y * ratio + yOffset
|
||||
|
||||
@@ -58,7 +58,7 @@ sig
|
||||
, nextPlatID: int
|
||||
}
|
||||
|
||||
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t, jumped: int}
|
||||
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
|
||||
|
||||
type game_type =
|
||||
{ player: player
|
||||
@@ -135,7 +135,7 @@ struct
|
||||
, nextPlatID: int
|
||||
}
|
||||
|
||||
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t, jumped: int}
|
||||
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
|
||||
|
||||
type game_type =
|
||||
{ player: player
|
||||
|
||||
Reference in New Issue
Block a user