mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-25 11:18:55 +00:00
Updated CLI unit tests again.
This commit is contained in:
parent
41967b11f7
commit
a4ebde3e07
@ -53,24 +53,24 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
|
||||
|
||||
world.Space = space
|
||||
|
||||
moveToCollide := false
|
||||
moveToCollide := true
|
||||
if moveToCollide {
|
||||
effPushback := Vec2D{X: float64(0), Y: float64(0)}
|
||||
toTestPlayerCollider := playerColliders[0]
|
||||
toTestPlayerCollider.X += -2.98
|
||||
toTestPlayerCollider.Y += -50.0
|
||||
toTestPlayerCollider.X += -50.0
|
||||
toTestPlayerCollider.Y += -60.0
|
||||
toTestPlayerCollider.Update()
|
||||
oldDx, oldDy := float64(0), float64(0)
|
||||
if collision := toTestPlayerCollider.Check(oldDx, oldDy); collision != nil {
|
||||
playerShape := toTestPlayerCollider.Shape.(*resolv.ConvexPolygon)
|
||||
for _, obj := range collision.Objects {
|
||||
barrierShape := obj.Shape.(*resolv.ConvexPolygon)
|
||||
if overlapped, pushbackX, pushbackY := CalcPushbacks(oldDx, oldDy, playerShape, barrierShape); overlapped {
|
||||
if overlapped, pushbackX, pushbackY, overlapResult := CalcPushbacks(oldDx, oldDy, playerShape, barrierShape); overlapped {
|
||||
Logger.Info(fmt.Sprintf("Overlapped: a=%v, b=%v, pushbackX=%v, pushbackY=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), pushbackX, pushbackY))
|
||||
effPushback.X += pushbackX
|
||||
effPushback.Y += pushbackY
|
||||
} else {
|
||||
Logger.Info(fmt.Sprintf("Collider BUT not overlapped: a=%v, b=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape)))
|
||||
Logger.Info(fmt.Sprintf("Collided BUT not overlapped: a=%v, b=%v, overlapResult=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), overlapResult))
|
||||
}
|
||||
}
|
||||
toTestPlayerCollider.X -= effPushback.X
|
||||
|
@ -55,7 +55,7 @@ func GenerateConvexPolygonCollider(unalignedSrc *Polygon2D, spaceOffsetX, spaceO
|
||||
return collider
|
||||
}
|
||||
|
||||
func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.ConvexPolygon) (bool, float64, float64) {
|
||||
func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.ConvexPolygon) (bool, float64, float64, *SatResult) {
|
||||
origX, origY := playerShape.Position()
|
||||
defer func() {
|
||||
playerShape.SetPosition(origX, origY)
|
||||
@ -71,9 +71,9 @@ func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.Conve
|
||||
}
|
||||
if overlapped := IsPolygonPairOverlapped(playerShape, barrierShape, overlapResult); overlapped {
|
||||
pushbackX, pushbackY := overlapResult.Overlap*overlapResult.OverlapX, overlapResult.Overlap*overlapResult.OverlapY
|
||||
return true, pushbackX, pushbackY
|
||||
return true, pushbackX, pushbackY, overlapResult
|
||||
} else {
|
||||
return false, 0, 0
|
||||
return false, 0, 0, overlapResult
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="2" name="PlayerStartingPos">
|
||||
<object id="135" x="1516.33" y="2113">
|
||||
<object id="135" x="1513.33" y="1996">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="137" x="2270" y="1640">
|
||||
|
@ -371,7 +371,7 @@ TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNo
|
||||
const tilesElListUnderTilesets = {};
|
||||
for (let tsxFilenameIdx = 0; tsxFilenameIdx < tsxFileNames.length; ++tsxFilenameIdx) {
|
||||
const tsxOrientation = tileSets[tsxFilenameIdx].orientation;
|
||||
if (cc.TiledMap.Orientation.ORTHO == tsxOrientation) {
|
||||
if (cc.TiledMap.Orientation.ORTHO != tsxOrientation) {
|
||||
cc.error("Error at tileset %s: We proceed with ONLY tilesets in ORTHO orientation for all map orientations by now.", tsxFileNames[tsxFilenameIdx]);
|
||||
continue;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user