More cleanup?
This commit is contained in:
@@ -2,12 +2,9 @@ function CubeEntity() {
|
||||
Entity.call(this);
|
||||
|
||||
this.add(POSITION);
|
||||
this.position.position = new Vec3(1, 0, 0);
|
||||
this.add(MESH);
|
||||
this.add(MATERIAL);
|
||||
|
||||
this.position.x = 0;
|
||||
this.position.y = 0;
|
||||
this.position.z = 0;
|
||||
}
|
||||
|
||||
CubeEntity.prototype = Object.create(Entity.prototype);
|
||||
@@ -16,9 +13,13 @@ CubeEntity.prototype.constructor = CubeEntity;
|
||||
CubeEntity.prototype.update = function() {
|
||||
var speed = 3.0;
|
||||
var move = Input.axis2D(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT, INPUT_ACTION_UP, INPUT_ACTION_DOWN);
|
||||
this.position.x += move.x * speed * TIME.delta;
|
||||
this.position.z += move.y * speed * TIME.delta;
|
||||
var pos = this.position.position;
|
||||
this.position.position = new Vec3(
|
||||
pos.x + move.x * speed * TIME.delta,
|
||||
pos.y,
|
||||
pos.z + move.y * speed * TIME.delta
|
||||
);
|
||||
this.material.setColor(Color.rainbow());
|
||||
};
|
||||
|
||||
module = CubeEntity;
|
||||
module = CubeEntity;
|
||||
|
||||
Reference in New Issue
Block a user