Drafted backend collision with pushback calculations.

This commit is contained in:
yflu
2022-10-21 22:39:08 +08:00
parent bc8989a0e6
commit 150e30db2a
4 changed files with 48 additions and 50 deletions

View File

@@ -56,10 +56,8 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
moveToCollide := true
if moveToCollide {
toTestPlayerCollider := playerColliders[0]
oldDx := 135.0
oldDy := 135.0
dx := oldDx
dy := oldDy
oldDx, oldDy := 135.0, 135.0
dx, dy := oldDx, oldDy
if collision := toTestPlayerCollider.Check(oldDx, oldDy, "Barrier"); collision != nil {
playerShape := toTestPlayerCollider.Shape.(*resolv.ConvexPolygon)
barrierShape := collision.Objects[0].Shape.(*resolv.ConvexPolygon)