function CubeEntity() { Entity.call(this); this.add(POSITION); this.position.position = new Vec3(1, 0, 0); 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); 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;