Cleanup, prepping for example game stuff
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
var OverworldEntity = include('entities/OverworldEntity.js');
|
||||
|
||||
function CubeEntity() {
|
||||
OverworldEntity.call(this);
|
||||
|
||||
this.add(MESH);
|
||||
this.add(MATERIAL);
|
||||
}
|
||||
|
||||
CubeEntity.prototype = Object.create(OverworldEntity.prototype);
|
||||
CubeEntity.prototype.constructor = CubeEntity;
|
||||
|
||||
CubeEntity.prototype.update = function() {
|
||||
OverworldEntity.prototype.update.call(this);
|
||||
var speed = 3.0;
|
||||
var move = Input.axis2D(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT, INPUT_ACTION_UP, INPUT_ACTION_DOWN);
|
||||
this.position.position.x += move.x * speed * TIME.delta;
|
||||
this.position.position.z += move.y * speed * TIME.delta;
|
||||
this.material.setColor(Color.rainbow());
|
||||
};
|
||||
|
||||
module = CubeEntity;
|
||||
@@ -0,0 +1,21 @@
|
||||
function OverworldEntity() {
|
||||
Entity.call(this);
|
||||
|
||||
this.add(POSITION);
|
||||
}
|
||||
|
||||
OverworldEntity.prototype = Object.create(Entity.prototype);
|
||||
OverworldEntity.prototype.constructor = OverworldEntity;
|
||||
|
||||
OverworldEntity.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.position.x += move.x * speed * TIME.delta;
|
||||
// this.position.position.z += move.y * speed * TIME.delta;
|
||||
}
|
||||
|
||||
OverworldEntity.prototype.dispose = function() {
|
||||
// Nothing to dispose
|
||||
}
|
||||
|
||||
module = OverworldEntity;
|
||||
@@ -1,21 +0,0 @@
|
||||
function CubeEntity() {
|
||||
Entity.call(this);
|
||||
this.add(POSITION);
|
||||
this.add(MESH);
|
||||
this.add(MATERIAL);
|
||||
}
|
||||
|
||||
CubeEntity.prototype = Object.create(Entity.prototype);
|
||||
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.position.x += move.x * speed * TIME.delta;
|
||||
// this.position.position.z += move.y * speed * TIME.delta;
|
||||
// this.position.rotation.x += 3 * TIME.delta;
|
||||
// this.position.rotation.z += 2 * TIME.delta;
|
||||
this.material.setColor(Color.rainbow());
|
||||
};
|
||||
|
||||
module = CubeEntity;
|
||||
@@ -1,4 +1,4 @@
|
||||
var Cube = include('entities/cube.js');
|
||||
var CubeEntity = include('entities/CubeEntity.js');
|
||||
|
||||
function CubeScene() {
|
||||
this.cam = new Entity();
|
||||
@@ -8,7 +8,7 @@ function CubeScene() {
|
||||
this.cam.position.position = new Vec3(3, 3, 3);
|
||||
this.cam.position.lookAt(new Vec3(0, 0, 0));
|
||||
|
||||
this.cube = new Cube();
|
||||
this.cube = new CubeEntity();
|
||||
}
|
||||
|
||||
CubeScene.prototype = Object.create(Scene.prototype);
|
||||
|
||||
Reference in New Issue
Block a user