diff options
Diffstat (limited to 'assets/javascripts/mx/extensions')
| -rw-r--r-- | assets/javascripts/mx/extensions/mx.movements.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/assets/javascripts/mx/extensions/mx.movements.js b/assets/javascripts/mx/extensions/mx.movements.js index 4f39f66..164d747 100644 --- a/assets/javascripts/mx/extensions/mx.movements.js +++ b/assets/javascripts/mx/extensions/mx.movements.js @@ -198,14 +198,13 @@ MX.Movements = function (cam, viewHeight) { var s = creeping ? scale * creepFactor : scale var vrrrr = creeping ? vr * creepFactor * 5 : vr + vx = vz = 0 + pos.x = cam.x - pos.y = cam.y pos.z = cam.z if (moveForward || moveBackward || moveRight || moveLeft || moveUp || moveDown || turnLeft || turnRight || turnUp || turnDown) { - vx = vy = vz = 0 - if (moveForward) { vx += v * Math.cos(ry + Math.PI / 2) * s vz += v * Math.sin(ry + Math.PI / 2) * s @@ -245,24 +244,33 @@ MX.Movements = function (cam, viewHeight) { pos.x += vx pos.y += vy pos.z += vz - - if (vx || vz) { - app.tube("move", pos) - } } if (gravity) { vy -= 1 * scale - cam.y += vy + pos.y += vy - if (cam.y <= viewHeight * scale) { - cam.y = viewHeight * scale + if (pos.y <= viewHeight) { + pos.y = viewHeight vy = 0 jumping = false + vz = vz || 1 } + + var ceiling = (mover.room ? mover.room.height : 5000) + + if (pos.y >= ceiling) { + vy = 0 + pos.y = ceiling + vz = vz || 1 + } + } + if (vx || vy || vz) { + app.tube("move", pos) + } }, lock: function(){ locked = true }, |
