-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectStatic.class.js
70 lines (50 loc) · 1.25 KB
/
ObjectStatic.class.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { GameObject } from './Object.class.js'
var ObjectStatic = function() {
var that = new GameObject();
that.sensors_flipped = null;
that.heightMaps = [];
that.heightMaps_flipped = [];
that.default_sensor_height = 42;
that.physics = function() {
};
that.frame_update = function () {
this.frame_speed = 0.2;
this.frame += this.frame_speed /** filter_fps_lag()*/;
};
that.updateSensors = function() {
for (var a in that.sensors) {
that.sensors[a].update(that);
}
};
that.resetSensors = function() {
for (var a in that.sensors) {
that.sensors[a].colliding_with.clear();
that.sensors[a].colliding = false;
}
that.colliding_sensors.clear();
};
that.initFlippedHeightMaps = function() {
that.heightMaps_flipped['floor'] = that.heightMaps['floor'].slice(0).reverse() ;
};
that.flip = function() {
var tmp;
that.flipped = true;
/*
* Flip Sensors
*/
that.initFlippedSensors();
tmp = that.sensors;
that.sensors = that.sensors_flipped;
that.sensors_flipped = tmp;
/*
* Flip HeightMaps
*/
that.initFlippedHeightMaps();
tmp = that.heightMaps;
that.heightMaps = that.heightMaps_flipped;
that.heightMaps_flipped = tmp;
that.updateSensors();
};
return that;
};
export { ObjectStatic }