BlueGit

timfa frameworkv3

allObjects

timfa Tim Falken · pushed by timfa

Authored 2019-02-14 · 7 years ago

Hash
62106b5b0c28e707ec9f5121c117d0ec23cfd016
Parent
ed1a2a21
1 file changed +7 −2
framework/object.js +7 −2
@@ -6,7 +6,6 @@ var GameObject =
6 6
7 7 destroyed: false,
8 8
9
10 9 create: function(template, x, y, image, layer, scene)
11 10 {
12 11 var newObj = $.extend(true, {}, template);
@@ -17,6 +16,11 @@ var GameObject =
17 16
18 17 newObj.renderer.layerDepth = layer;
19 18
19 if(!GameObject.allObjects)
20 GameObject.allObjects = [];
21
22 GameObject.allObjects.push(newObj);
23
20 24 return newObj;
21 25 },
22 26
@@ -345,12 +349,13 @@ var GameObject =
345 349 {
346 350 if(!this.g_destroy)
347 351 {
348
349 352 if (typeof this.onDestroy == 'function') { this.onDestroy(); }
350 353
351 354 this.destroyed = true;
352 355
353 356 this.g_destroy = true;
357
358 GameObject.allObjects.remove(this);
354 359 }
355 360 }
356 361
@@ -6,7 +6,6 @@ var GameObject =
6
6
7 destroyed: false,
7 destroyed: false,
8
8
9
10 create: function(template, x, y, image, layer, scene)
9 create: function(template, x, y, image, layer, scene)
11 {
10 {
12 var newObj = $.extend(true, {}, template);
11 var newObj = $.extend(true, {}, template);
@@ -17,6 +16,11 @@ var GameObject =
17
16
18 newObj.renderer.layerDepth = layer;
17 newObj.renderer.layerDepth = layer;
19
18
19 if(!GameObject.allObjects)
20 GameObject.allObjects = [];
21
22 GameObject.allObjects.push(newObj);
23
20 return newObj;
24 return newObj;
21 },
25 },
22
26
@@ -345,12 +349,13 @@ var GameObject =
345 {
349 {
346 if(!this.g_destroy)
350 if(!this.g_destroy)
347 {
351 {
348
349 if (typeof this.onDestroy == 'function') { this.onDestroy(); }
352 if (typeof this.onDestroy == 'function') { this.onDestroy(); }
350
353
351 this.destroyed = true;
354 this.destroyed = true;
352
355
353 this.g_destroy = true;
356 this.g_destroy = true;
357
358 GameObject.allObjects.remove(this);
354 }
359 }
355 }
360 }
356
361