Search the Community
Showing results for tags 'pooling'.
-
I have Class constructor that require options parameter, that parameter is plainobject {}, also it has 0 or more arrays inside and another plainobjects. I create a lot of instances of this Class and these are succesfully pooled already. But I am wondering what to do with this options param like this one: { type: "type", ..., bodies: [ { type: "type" ..., }, ... ], ... } Sometimes options param is hardcoded, sometimes algorithm gets it by net connection in arraybuffer to recreate {} & []; What is worth pooling mechanism in javascript? For sure complex objects with a lot of properties and inner objects. What about these little guys then? {} & [] Is it worth to pool empty plain objects and arrays? With releasing it to pool you would remove all properties in {} and setting length to 0 in array.
- 1 reply
-
- garbagecollector
- javascript
-
(and 1 more)
Tagged with:
-
I based my game's bullet system on "Phaser Coding Tips 7", the create a Shoot-em-up tutorial (http://phaser.io/tutorials/coding-tips-007). Everything works fine until I reset the state, and I can't figure out any solution (this.getFirstExists(false) fails to find any bullets). The tutorial source code is available on: http://jsbin.com/ferapejeja/edit?js,output I added this in the Create-function at JS Bin to simulate the exact same problem I face in my game: var reset = this.input.keyboard.addKey(Phaser.Keyboard.R);reset.onDown.add(function(){this.game.state.start('Game');}, this);If I hit "R" during game play the state resets as expected, and everything seems to work OK except the bullets wont work. Any ideas on how this could be solved?