summaryrefslogtreecommitdiff
path: root/assets/javascripts
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-04-25 12:12:21 -0400
committerJules Laplace <jules@okfoc.us>2014-04-25 12:12:21 -0400
commit0772bb5e55d0d00c925620a27b59a7f52aaa4199 (patch)
tree780b8b7685976014df8b5741b56ba96eecd67a82 /assets/javascripts
parent6a39854726c511f3df0b4aff619ecac1943c993c (diff)
ceiling
Diffstat (limited to 'assets/javascripts')
-rw-r--r--assets/javascripts/mx/extensions/mx.movements.js28
-rw-r--r--assets/javascripts/rectangles/_env.js13
-rw-r--r--assets/javascripts/rectangles/engine/mover.js3
3 files changed, 22 insertions, 22 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 },
diff --git a/assets/javascripts/rectangles/_env.js b/assets/javascripts/rectangles/_env.js
index 9bdad6a..1252778 100644
--- a/assets/javascripts/rectangles/_env.js
+++ b/assets/javascripts/rectangles/_env.js
@@ -4,7 +4,7 @@ environment.init = function(){
if (window.scene) {
scene.camera.move({
"x": 1000,
- "y": 1500,
+ "y": 0,
"z": 250,
"rotationX": 0, // PI/2,
"rotationY": PI/2, // PI
@@ -30,23 +30,16 @@ environment.init = function(){
rect: new rect(450,150, 650,350),
height: 300,
}))
+
app.movements.gravity(true)
- if (window.location.href.match(/stone/)) {
- app.on("clip", function(){
- $(".face").css({
- "background-image": "url(http://i.asdf.us/im/4a/_1398144847_frankhats.gif)"
- })
- })
- $("#map").hide()
- }
+ $("#map").hide()
builder.init()
clipper.init()
mover.init()
window.scene && scene.update()
environment.update()
-
}
environment.update = function(t){
if (window.scene && scene.camera) {
diff --git a/assets/javascripts/rectangles/engine/mover.js b/assets/javascripts/rectangles/engine/mover.js
index 71656ef..757dbfa 100644
--- a/assets/javascripts/rectangles/engine/mover.js
+++ b/assets/javascripts/rectangles/engine/mover.js
@@ -16,10 +16,9 @@ var mover = new function(){
var radius = scene.camera.radius
cam.y = pos.y
-
+
// if we were in a room already..
if (base.room) {
-
// check if we're still in the room
if (base.room.rect.containsDisc(pos.x, pos.z, radius)) {
cam.x = pos.x