Joldror

Members
  • Content Count

    6
  • Joined

  • Last visited

About Joldror

  • Rank
    Newbie
  • Birthday 05/30/1984

Profile Information

  • Gender
    Male
  • Location
    Barcelona (Spain)
  1. I feel more than stupid. It's outOfBoundsKill and not outOfBoundKill like I wrote it.
  2. But it does not change anything. The events are added for debug purpose only. The game should run ok with or without the events. Anyway, I tested with add instead of addOnce and teh result is exactly the same.
  3. Yes. I tested again just in case and the event onOutOfBounds is triggered every time. EDIT: I tested again both events. throwSomething() { var throwerNumber = this.game.rnd.integerInRange(0, 2); var throwedObject = this.game.rnd.integerInRange(1, 100); if (throwedObject <= this.coinPercentage) { this.coin = this.coins.getFirstExists(false); this.coin.reset(this.throwers_x[throwerNumber], this.throwers_y); this.coin.events.onOutOfBounds.addOnce(this.debugOut, this); this.coin.events.onKilled.addOnce(this.debugKilled, this); this.coin.animations.add('spin', [0, 1, 2, 3, 4, 5, 6, 7], 10, true); this.coin.play('spin'); this.coin.body.gravity.y = -300; } else { // TODO: throw dangers } this.throwingTimer = this.game.time.now + 2000; } debugOut() { console.log('something is out of bounds'); } debugKilled() { console.log('something is dead'); }And this is what I get in the java console:
  4. I tried those events and the exists property was false always. Although I tried to debug with the Chrome developer tools using breakpoints, every iteraction one more coin was set to exists true, while none went back to false. My thought is either outOfBoundKill or checkWorldBounds is not triggering (or neither of them).
  5. I just tested in a game with four states. Runs perfectly, just as with 2.0.2.
  6. Hi, I'm new (another one) with phaser. I did a test game without problems (or almost) but now I'm doing a game that throws objects ad infinitum. In order to do this I'm sprite recycling. I have a group of sprites with outOfBoundsKill and checkWorldBounds set to true. And then when it's time to throw an object I fetch the first that does not exists. Here's my code: // Coinsthis.coins = this.add.group();this.coins.enableBody = true;this.coins.physicsBodyType = Phaser.Physics.ARCADE;this.coins.createMultiple(4, 'coin');this.coins.setAll('outOfBoundKill', true);this.coins.setAll('checkWorldBounds', true);And this is the function to throw coins (from the bottom of the world to the top): throwSomething() { this.coin = this.coins.getFirstExists(false); this.coin.reset(this.throwers_x[droperNumber], this.throwers_y); this.coin.animations.add('spin', [0, 1, 2, 3, 4, 5, 6, 7], 10, true); this.coin.play('spin'); this.coin.body.gravity.y = -300; this.dropingTimer = this.game.time.now + 2000;}The moment all coins are created there's no coins with exists set to false. It should be, since outOfBoundKill is on. The animation add and play, and the body.gravity were in the create function at the beginning, but I changed to test things. Any ideas?