progress towards letting enemy drop below platform if path to player is there
This commit is contained in:
@@ -194,6 +194,19 @@ struct
|
|||||||
andalso (ey > platY andalso ey + Constants.jumpLimit >= platY)
|
andalso (ey > platY andalso ey + Constants.jumpLimit >= platY)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun canDrop (nextPlatform, platformTree, enemy) =
|
||||||
|
let
|
||||||
|
val {x = platX, y = platY, width = platW, ...} = nextPlatform
|
||||||
|
val platFinishX = platX + platW
|
||||||
|
|
||||||
|
val {x = eX, y = ey, yAxis = eyAxis, ...} = enemy
|
||||||
|
|
||||||
|
val standingOnPlat = standingOnArea (enemy, platformTree)
|
||||||
|
in
|
||||||
|
isBetween (platX, eX, platFinishX) andalso standingOnPlat
|
||||||
|
andalso ey < platY
|
||||||
|
end
|
||||||
|
|
||||||
(* get patches to help enemy move to nextPlatformID *)
|
(* get patches to help enemy move to nextPlatformID *)
|
||||||
fun getPathToNextPlatform
|
fun getPathToNextPlatform
|
||||||
(nextPlatformID, platforms, platformTree, enemy, eID, pID, acc) =
|
(nextPlatformID, platforms, platformTree, enemy, eID, pID, acc) =
|
||||||
@@ -203,13 +216,15 @@ struct
|
|||||||
val {x = eX, y = ey, yAxis = eyAxis, ...} = enemy
|
val {x = eX, y = ey, yAxis = eyAxis, ...} = enemy
|
||||||
|
|
||||||
val canJump = canJump (nextPlatform, platformTree, enemy)
|
val canJump = canJump (nextPlatform, platformTree, enemy)
|
||||||
|
val canDrop = canDrop (nextPlatform, platformTree, enemy)
|
||||||
in
|
in
|
||||||
if canJump then
|
if canJump then
|
||||||
case eyAxis of
|
case eyAxis of
|
||||||
ON_GROUND => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc
|
ON_GROUND => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc
|
||||||
| FALLING => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc
|
| FALLING => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc
|
||||||
| _ => acc
|
| _ => acc
|
||||||
|
else if canDrop then
|
||||||
|
EnemyPatch.W_Y_AXIS DROP_BELOW_PLATFORM :: acc
|
||||||
else
|
else
|
||||||
acc
|
acc
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -162,11 +162,11 @@ struct
|
|||||||
* then set new yAxis to FALLING
|
* then set new yAxis to FALLING
|
||||||
* so we do not drop below any platforms again
|
* so we do not drop below any platforms again
|
||||||
* *)
|
* *)
|
||||||
if QuadTree.hasCollisionAt (x, y, size, size, 0, 0, ww, wh, ~1,
|
if
|
||||||
platformTree)
|
QuadTree.hasCollisionAt
|
||||||
then
|
(x, y, size, size, 0, 0, ww, wh, ~1, platformTree)
|
||||||
Fn.W_Y_AXIS FALLING :: acc
|
then acc
|
||||||
else acc
|
else Fn.W_Y_AXIS FALLING :: acc
|
||||||
| _ => acc
|
| _ => acc
|
||||||
|
|
||||||
val wallCollisions = QuadTree.getCollisionSides
|
val wallCollisions = QuadTree.getCollisionSides
|
||||||
|
|||||||
Reference in New Issue
Block a user