Azumi

Members
  • Content Count

    7
  • Joined

  • Last visited

About Azumi

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks I fixed this problem, it shouldn't appear anymore. I attach current version of game script here. game.js
  2. Thanks! I didn't want to change the original "phaser.js" file in case of future upgrade so i just added these two in my "game.js" But in my opinion this kind of functionality should be implemented in stock phaser.
  3. Thanks for all the help. I looked into source code of the framework and added changed versions of functions that already exists there. I changed the "for" loop in iterate function. It probably is a little bit of an overkill but it works fine so far. Phaser.Group.prototype.reverseIterate = function (key, value, returnType, callback, callbackContext, args) { if (this.children.length === 0) { if (returnType === Phaser.Group.RETURN_TOTAL) { return 0; } else if (returnType === Phaser.Group.RETURN_ALL) { return []; } } var total = 0; if (returnType === Phaser.Group.RETURN_ALL) { var output = []; } for (var i = this.children.length - 1; i >= 0 ; i--) { if (this.children[i][key] === value) { total++; if (callback) { if (args) { args[0] = this.children[i]; callback.apply(callbackContext, args); } else { callback.call(callbackContext, this.children[i]); } } if (returnType === Phaser.Group.RETURN_CHILD) { return this.children[i]; } else if (returnType === Phaser.Group.RETURN_ALL) { output.push(this.children[i]); } } } if (returnType === Phaser.Group.RETURN_TOTAL) { return total; } else if (returnType === Phaser.Group.RETURN_ALL) { return output; } else { // RETURN_CHILD or RETURN_NONE return null; } }; Phaser.Group.prototype.forEachAliveReverse = function (callback, callbackContext) { var args; if (arguments.length > 2) { args = [null]; for (var i = 2; i < arguments.length; i++) { args.push(arguments[i]); } } this.reverseIterate('alive', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); };
  4. Hello. I am working on a game that is a clone of a popular "Zuma". It is based on Phaser framework. You can see what I have done so far under this address -> http://azumi.nstrefa.pl/game/index.html I still have problems with balls movement after bullet hits the ones that are on track. If you have any suggestions what I could do to fix it I would be great, because it seems I have hit a wall with resolving this issue. Source code for the game is in the attachment. game.js
  5. Thank you for replying. From what I understand, this loop would get me all children, not only the ones that are alive?
  6. I have battled this problem myself recently and came up with this (working!) solution: function angle(cx, cy, ex, ey) { var dy = ey - cy; var dx = ex - cx; return Math.atan2(dy, dx); } function update() { var r = 44; var bulltargetAngle = angle( circleCenter.x, circleCenter.y, this.game.input.activePointer.x, this.game.input.activePointer.y); bullet.y = player.y + Math.sin(bulltargetAngle) * r; bullet.x = player.x + Math.cos(bulltargetAngle) * r; } In the above code a sprite named "bullet" rotates around the circle pattern following mouse pointer.
  7. Hello. When I use forEachAlive loop on a group I see that it goes in ascending index order, I need to loop through group children in reverse order without changing their indexes or display order. I searched on google, in documentation ad in examples but I can't find a solution. I will be very grateful for any help.