-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneObject.js
More file actions
39 lines (32 loc) · 1.03 KB
/
SceneObject.js
File metadata and controls
39 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var SceneObject = function(args) {
if(args === undefined) args = {};
this.x = (args.x !== undefined)? args.x : 0;
this.y = (args.y !== undefined)? args.y : 0;
this.z = (args.z !== undefined)? args.z : 0;
this.name = (args.name !== undefined)? args.name : 'SceneObject'+(~~(Math.random() * 1000000000));
this.width = 0;
this.height = 0;
this.solid = false;
this.visible = false;
this.controllers = [];
}
SceneObject.prototype.onCollision = function(otherSceneObject) {
/* No native behaviour */
}
SceneObject.prototype.onEvent = function(args) {
/* No native behaviour */
}
SceneObject.prototype.update = function(args) {
/* No native behaviour */
}
SceneObject.prototype.draw = function(args) {
/* No native behaviour */
}
SceneObject.prototype.isOverlapping = function(sceneObject) {
return false;
}
SceneObject.prototype.getCollisionBlock = function() { return undefined; }
SceneObject.prototype.addController = function(controller) {
this.controllers[this.controllers.length] = controller;
controller.setSceneObject(this);
}