Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 428 bytes modified
parent
53106bafea
commit
7e628ab1c7
|
@ -165,22 +165,39 @@ GameLib.CustomCode.prototype.adjustSpeed = function(delta) {
|
||||||
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.adjustSnailPosition = function(diff) {
|
GameLib.CustomCode.prototype.adjustSnailPosition = function(delta) {
|
||||||
|
|
||||||
this.snail.position.z -= diff * 0.001 * this.speed;
|
var diff = 0;
|
||||||
|
var modified = false;
|
||||||
if (this.snail.position.z < -4.8) {
|
|
||||||
this.snail.position.z = -4.8;
|
if (this.movement.left) {
|
||||||
|
diff = data.delta * this.speed * 0.01;
|
||||||
|
this.snail.position.z -= diff;
|
||||||
|
this.movement.left = false;
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.snail.position.z > 4.8) {
|
if (this.movement.right) {
|
||||||
this.snail.position.z = 4.8;
|
diff = data.delta * this.speed * 0.01;
|
||||||
|
this.snail.position.z += diff;
|
||||||
|
this.movement.right = false;
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modified) {
|
||||||
|
if (this.snail.position.z < -4.8) {
|
||||||
|
this.snail.position.z = -4.8;
|
||||||
|
}
|
||||||
|
|
||||||
this.solar.position.z = this.snail.position.z;
|
if (this.snail.position.z > 4.8) {
|
||||||
|
this.snail.position.z = 4.8;
|
||||||
|
}
|
||||||
|
|
||||||
this.snail.updateInstance('position');
|
this.solar.position.z = this.snail.position.z;
|
||||||
this.solar.updateInstance('position');
|
|
||||||
|
this.snail.updateInstance('position');
|
||||||
|
this.solar.updateInstance('position');
|
||||||
|
}
|
||||||
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
@ -195,6 +212,13 @@ GameLib.Event.Subscribe(
|
||||||
this.speed = 0;
|
this.speed = 0;
|
||||||
this.speedUp = false;
|
this.speedUp = false;
|
||||||
|
|
||||||
|
this.movement = {
|
||||||
|
left : false,
|
||||||
|
right : false,
|
||||||
|
leftAmount : 0,
|
||||||
|
rightAmount : 0
|
||||||
|
};
|
||||||
|
|
||||||
this.clouds.map(
|
this.clouds.map(
|
||||||
function(cloud) {
|
function(cloud) {
|
||||||
cloud.geometry = null;
|
cloud.geometry = null;
|
||||||
|
|
Loading…
Reference in New Issue