arun

Members
  • Content count

    5
  • Joined

  • Last visited

About arun

  • Rank
    Newbie

Recent Profile Visitors

58 profile views
  1. dear friends, I am sometimes in trouble while ordering the custom functions. In which order they should be put?
  2. Hi friends, please explain me the code below. why we use return here? fire: function() { if (this.nextShotAt > this.time.now) { return; } if (this.bulletPool.countDead() === 0) { return; }
  3. but, this.time.now means which time it indicate?
  4. dear friends, I don't understand the 2 lines of code below. please help me if (this.time.now > shootTime) { nut = nuts.getFirstExists(false); }
  5. hi, i am following phaser tutorial . but, i don't understand the fire: function() code. please help me create: function () { ... this.bullets = []; // Add an empty sprite group into our game this.bulletPool = this.add.group(); // Enable physics to the whole sprite group this.bulletPool.enableBody = true; this.bulletPool.physicsBodyType = Phaser.Physics.ARCADE; // Add 100 'bullet' sprites in the group. // By default this uses the first frame of the sprite sheet and // sets the initial state as non-existing (i.e. killed/dead) this.bulletPool.createMultiple(100, 'bullet'); // Sets anchors of all sprites this.bulletPool.setAll('anchor.x', 0.5); this.bulletPool.setAll('anchor.y', 0.5); // Automatically kill the bullet sprites when they go out of bounds this.bulletPool.setAll('outOfBoundsKill', true); this.bulletPool.setAll('checkWorldBounds', true); this.nextShotAt = 0; fire: function() { if (this.nextShotAt > this.time.now) { return; } if (this.bulletPool.countDead() === 0) { return; } this.nextShotAt = this.time.now + this.shotDelay; // Find the first dead bullet in the pool var bullet = this.bulletPool.getFirstExists(false); // Reset (revive) the sprite and place it in a new location bullet.reset(this.player.x, this.player.y - 20); bullet.body.velocity.y = -500; },