free falling

after falling off most open maps you don't take damage
  you fall down into the level again above the entrance

disabled smooth camera tracking for
  portals
  falling off map

added a once every 7 seconds check to see if the player is suck inside the map
  if stuck you teleport to the level entrance
  catches about 90% of the ways to get stuck from falling too fast
  this might causing problems after more testing, not sure

bug fixes
This commit is contained in:
landgreen
2023-10-15 19:59:47 -07:00
parent b14f2c1eca
commit ff613dc2cf
8 changed files with 205 additions and 129 deletions

View File

@@ -196,14 +196,11 @@ const m = {
look() { }, //set to lookDefault()
lookDefault() {
//always on mouse look
m.angle = Math.atan2(
simulation.mouseInGame.y - m.pos.y,
simulation.mouseInGame.x - m.pos.x
);
m.angle = Math.atan2(simulation.mouseInGame.y - m.pos.y, simulation.mouseInGame.x - m.pos.x);
//smoothed mouse look translations
const scale = 0.8;
m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale;
m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale;
m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale
m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale
m.transX += (m.transSmoothX - m.transX) * m.lookSmoothing;
m.transY += (m.transSmoothY - m.transY) * m.lookSmoothing;
@@ -4609,6 +4606,7 @@ const m = {
m.hole.isReady = false;
m.fieldRange = 0
Matter.Body.setPosition(player, simulation.mouseInGame);
// simulation.translatePlayerAndCamera(simulation.mouseInGame) //too jerky
m.buttonCD_jump = 0 //this might fix a bug with jumping
const velocity = Vector.mult(Vector.normalise(sub), 20)
Matter.Body.setVelocity(player, {