You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes:
Fixed#2 and #6 (applied #3)
Added screen nodes that detect both boxes and triangles; fixed screen node overapping
Added left / right push feature to the level editor
Fixed level editor mispositioning temporary obstacle when the camera is moved upwards
misc. small tweaks
pointInBox (o.x, o.y + obstacleSize, playerX - playerSize / 2, playerY + playerSize, playerX + playerSize / 2, playerY)) { // Player definitely clips the triangle (some point of the triangle is in the player)
434
+
435
+
kill ();
436
+
break;
437
+
}
438
+
if (pointInTriangle (playerX - playerSize / 2, playerY, points) ||
if (prevY >= o.y + obstacleSize / 2 + playerSize / 2 && o.y + obstacleSize / 2 + playerSize / 2 > tempY) { // Only raise the player if the player was above the box and the current raise is below that of the obstacle
505
+
if (betweenIn(playerVelX * (abs (max(prevY, o.y) - min(prevY, o.y)) - playerSize / 2 - obstacleSize / 2) / playerVelY + prevX, o.x - obstacleSize / 2 - playerSize / 2, o.x + obstacleSize / 2 + playerSize / 2)) { // Check whether the player landed on top of the box
506
+
tempY = o.y + obstacleSize / 2 + playerSize / 2; // Raise the player
507
+
}
440
508
}
441
509
}
510
+
playerY = tempY; // Apply the raising
442
511
}
443
512
444
513
for (Obstacleo : boxes) { // Second check to kill the player (if needed)
445
-
446
-
if(!o.inCollisionRegion()) {
514
+
if (!o.inCollisionRegion ()) {
447
515
continue;
448
516
}
449
517
450
-
if (abs(playerX - o.x) > abs(playerY - o.y)) { // Player (probably) approached from the side (defaults to y axis if equal!!!)
451
-
kill();
518
+
/*if (abs(playerX - o.x) > abs(playerY - o.y)) { // Player (probably) approached from the side (defaults to y axis if equal!!!)
519
+
kill();
452
520
return;
453
521
} else { // Player (probably) approached from the Y axis
454
522
int sgn = (gravity < 0)? -1 : 1;
455
-
if (!(playerY - o.y > 0 && sgn == 1 || playerY - o.y < 0 && sgn == -1)) { // Player collided on the incorrect side
456
-
kill();
523
+
if (!(playerY - o.y > 0 && sgn == 1 || playerY - o.y < 0 && sgn == -1)) { // Player collided on the incorrect side
524
+
kill();
457
525
return;
458
526
}
527
+
}*/
528
+
529
+
if (betweenIn(playerY - (playerY - prevY) * (abs (max(o.x, prevX) - min(o.x, prevX)) - obstacleSize / 2 - playerSize / 2) / playerVelX, o.y - obstacleSize / 2 - playerSize / 2, o.y + obstacleSize / 2 + playerSize / 2)) { // Check whether the player landed on the side of the box
530
+
kill ();
531
+
return;
459
532
}
460
533
}
461
534
462
-
for (Obstacleo : triangles) { // Finally check the triangles
535
+
for (Obstacleo : triangles) { // Finally check the triangles (most load (??))
pointInBoxEx(o.x, o.y + obstacleSize, playerX - playerSize / 2, playerY + playerSize, playerX + playerSize / 2, playerY)) { // Player definately clips the triangle (some point of the triangle is in the player)
pointInBoxEx(o.x, o.y + obstacleSize, playerX - playerSize / 2, playerY + playerSize, playerX + playerSize / 2, playerY)) { // Player definately clips the triangle (some point of the triangle is in the player)
0 commit comments