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;
|
||||
|
||||
@@ -5,15 +5,14 @@ function CubeScene() {
|
||||
this.cam.add(POSITION);
|
||||
this.cam.add(CAMERA);
|
||||
|
||||
this.cam.position.x = 3;
|
||||
this.cam.position.y = 3;
|
||||
this.cam.position.z = 3;
|
||||
this.cam.position.lookAt(0, 0, 0);
|
||||
this.cam.position.position = new Vec3(3, 3, 3);
|
||||
this.cam.position.lookAt(new Vec3(0, 0, 0));
|
||||
|
||||
this.cube = new Cube();
|
||||
}
|
||||
|
||||
Object.assign(CubeScene, Scene.prototype);
|
||||
CubeScene.prototype = Object.create(Scene.prototype);
|
||||
CubeScene.prototype.constructor = CubeScene;
|
||||
|
||||
CubeScene.prototype.update = function() {
|
||||
this.cube.update();
|
||||
|
||||
Reference in New Issue
Block a user