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 *)
|
* fallingEnemies *)
|
||||||
let
|
let
|
||||||
val fallingList =
|
val fallingList =
|
||||||
{x = x, y = y, variant = #variant enemy, jumped = 0} :: fallingList
|
{x = x, y = y, variant = #variant enemy} :: fallingList
|
||||||
in
|
in
|
||||||
(enemyList, fallingList)
|
(enemyList, fallingList)
|
||||||
end
|
end
|
||||||
@@ -472,7 +472,7 @@ struct
|
|||||||
* fallingEnemies *)
|
* fallingEnemies *)
|
||||||
let
|
let
|
||||||
val fallingList =
|
val fallingList =
|
||||||
{x = x, y = y, variant = #variant enemy, jumped = 0} :: fallingList
|
{x = x, y = y, variant = #variant enemy} :: fallingList
|
||||||
in
|
in
|
||||||
(enemyList, fallingList)
|
(enemyList, fallingList)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ struct
|
|||||||
acc
|
acc
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val {x, y, jumped, variant} = Vector.sub (vec, pos)
|
val {x, y, variant} = Vector.sub (vec, pos)
|
||||||
|
|
||||||
val size = Constants.enemySize
|
val size = Constants.enemySize
|
||||||
val ww = Constants.worldWidth
|
val ww = Constants.worldWidth
|
||||||
@@ -59,21 +59,10 @@ struct
|
|||||||
(* filter out if player is attacking falling enemy *)
|
(* filter out if player is attacking falling enemy *)
|
||||||
updateList (pos - 1, vec, player, acc)
|
updateList (pos - 1, vec, player, acc)
|
||||||
else if Collision.isCollidingPlus (x, y, size, size, 0, 0, ww, wh) then
|
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
|
let
|
||||||
val updated =
|
val updated =
|
||||||
if jumped < Constants.jumpLimit then
|
{x = x, y = y - Constants.moveEnemyBy, variant = variant}
|
||||||
{ x = x
|
|
||||||
, y = y - Constants.moveEnemyBy
|
|
||||||
, jumped = jumped + Constants.moveEnemyBy
|
|
||||||
, variant = variant
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ x = x
|
|
||||||
, y = y + Constants.moveEnemyBy
|
|
||||||
, jumped = jumped
|
|
||||||
, variant = variant
|
|
||||||
}
|
|
||||||
in
|
in
|
||||||
updateList (pos - 1, vec, player, updated :: acc)
|
updateList (pos - 1, vec, player, updated :: acc)
|
||||||
end
|
end
|
||||||
@@ -89,7 +78,7 @@ struct
|
|||||||
Vector.concat acc
|
Vector.concat acc
|
||||||
else
|
else
|
||||||
let
|
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 x = Real32.fromInt x * ratio + xOffset
|
||||||
val y = Real32.fromInt y * ratio + yOffset
|
val y = Real32.fromInt y * ratio + yOffset
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ sig
|
|||||||
, nextPlatID: int
|
, 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 =
|
type game_type =
|
||||||
{ player: player
|
{ player: player
|
||||||
@@ -135,7 +135,7 @@ struct
|
|||||||
, nextPlatID: int
|
, 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 =
|
type game_type =
|
||||||
{ player: player
|
{ player: player
|
||||||
|
|||||||
Reference in New Issue
Block a user