Transaction 24504381e84196c7415cec8cc449befd29b073d74a687f5270a8f29bdb6bbdd7
1 Input
-
1f0496f821826195d114492de72f8c60bee1897986f985e0add17a012fc6ab00:0
OP_DATA_32(32) 117f692257b2331233b5705ce9c682be8719ff1b2b64cbca290bd6faeb54423eOP_CHECKSIG(172)OP_DATA_6(6) ¼¸"-ŠOP_DROP(117)OP_0(0)OP_IF(99)OP_DATA_3(3) ordOP_DATA_1(1)OP_DATA_15(15) text/javascriptOP_0(0)OP_PUSHDATA2(77) var Movement = pc.createScript('movement'); Movement.prototype.initialize = function() { this.camera = this.app.root.findByName('Camera'); this.power = 2500; this.lookSpeed = 0.2; this.force = new pc.Vec3(); this.eulers = new pc.Vec3(); this.impulse = new pc.Vec3(0, 1250, 0); this.allowJump = false; var app = this.app; app.mouse.on('mousemove', this._onMouseMove, this); app.mouse.on('mousedown', function () { app.mouse.enablePointerLock(); }, this); thiOP_PUSHDATA2(77) s.entity.collision.on("collisionend", this.onCollisionEnd, this); this.entity.collision.on("contact", this.onContact, this); }; Movement.prototype.update = function(dt) { var force = this.force; var app = this.app; var forward = this.camera.forward; var right = this.camera.right; var x = 0; var z = 0; var w = app.keyboard.isPressed(pc.KEY_W); var a = app.keyboard.isPressed(pc.KEY_A); var s = app.keyboard.isPressed(pc.KEY_S); var d = app.keyboard.isPressed(pc.KEY_D);OP_PUSHDATA2(77) var space = app.keyboard.wasReleased(pc.KEY_SPACE); var md = app.keyboard.wasReleased(pc.KEY_Q); var mi = app.keyboard.wasReleased(pc.KEY_E); if (a) { x -= right.x; z -= right.z; } if (d) { x += right.x; z += right.z; } if (w) { x += forward.x; z += forward.z; } if (s) { x -= forward.x; z -= forward.z; } if (space && this.allowJump == true) { this.entity.rigidbody.applyImpulse(this.impulse);OP_PUSHDATA2(77) } if (w || a || s || d || space) { this.entity.rigidbody.friction = 0; } else { this.entity.rigidbody.friction = 1; } if (x !== 0 || z !== 0) { force.set(x, 0, z).normalize().scale(this.power); this.entity.rigidbody.applyForce(force); } if (mi) { this.lookSpeed = this.lookSpeed + 0.05; } if (md && this.lookSpeed > 0.069) { this.lookSpeed = this.lookSpeed - 0.05; } }; Movement.prototype._onMouseMove = function(e) { iOP_PUSHDATA2(77) f (pc.Mouse.isPointerLocked() || e.buttons[0]) { this.eulers.x -= this.lookSpeed * e.dx; this.eulers.y -= this.lookSpeed * e.dy; this.eulers.y = Math.max(-90, Math.min(90, this.eulers.y)); this.camera.setLocalEulerAngles(this.eulers.y, this.eulers.x, 0); } }; Movement.prototype.onContact = function(result) { if (result) { if (result.contacts[0].localPoint.y >= -1.1 && result.contacts[0].localPoint.y <= -0.69) { this.allowJump = true; } else { this.allowJump = fOP_PUSHDATA1(76) alse; } } }; Movement.prototype.onCollisionEnd = function(result) { this.allowJump = false; };OP_ENDIF(104)
2 Outputs
- 24504381e84196c7415cec8cc449befd29b073d74a687f5270a8f29bdb6bbdd7:0
- 24504381e84196c7415cec8cc449befd29b073d74a687f5270a8f29bdb6bbdd7:1
value 546
address bc1pvlhrdze7vltj7q04ml2crnx7l3lh2w7gldxnch09vptten36mupswcsmm4
value 2704
address bc1qvtltywlxff60ezy8lq7997jq7r7udskmcpymm2