ugajin

Members
  • Content Count

    8
  • Joined

  • Last visited

About ugajin

  • Rank
    Newbie

Recent Profile Visitors

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

  1. Try moving the function expression collectStar inside 'main' main = . . . update : function(){ ... }, collectStar : function(player, star){ star.kill(); } }); You may also need to prefix the overlap callback with 'this' as in 'this.collectStar' It would be easier to help if you provided the project as a zip file, or something.
  2. ugajin

    gemmatch example

    Here is link to latest version, modelled on the original MS-DOS Shariki Sometime later... I have now [at last] found the solution that I was looking for, a solution that lets you position the tiles, anywhere on the canvas. But, I have found another issue, which I have not been able to fix. The example is intended to draw any shape tiles grid. After fixing an error to allow drawing any shape grid, the getMatches method fails for non-square grids. :[ Fixed it. I replaced the getMatches method after a complete rewrite. I can now declare non-square 2d arrays e.g. 6 x 8 or 8 x 6, and it works, as well as position the balls anywhere I like, Yippee! I use a single embedded for loop, no weird twist in the array indices, nor unnecessary duplicated conditions, and reduced the code from 79 to 54 lines. The original can be found here: https://www.joshmorony.com/how-to-create-a-candy-crush-or-bejeweled-game-in-phaser/
  3. One issue appears to be with the overlap callback function expression CollectStar, which is orphaned, Try this: function collectStar(player, star){ star.kill(); } function collectStar(player, star){ star.kill(); } You also have global variables, and a missing semicolon. Can you provide a link to the example?
  4. I was about to file a bug report on gitHub and saw a notice that the repo is for Phaser 3 related issues only. So, is the Phaser 2 repo closed? The bug relates to the beginFill(...) and arc(..., true) methods see below. Perhaps this has been fixed in v3? Here is the issue... let myGraphic = game.add.graphics(game.world.centerX, game.world.centerY); myGraphic.beginFill(0xFF3300, 0.5); myGraphic.arc(0, 0, 135, game.math.degToRad(0), game.math.degToRad(90), true); let myGraphic = game.add.graphics(game.world.centerX, game.world.centerY); myGraphic.beginFill(0xFF3300, 0.5); myGraphic.arc(0, 0, 135, game.math.degToRad(0), game.math.degToRad(90), true); The issue may be reproduced with the above code using the bool direction parameter set to true [anticlockwise] together with beginFill(...). Rather starting the arc at due east 0º, the fill is begun from about 7º. Oddly if rendered using lineStyle(...) only and without beginFill(...) it draws correctly, beginning at 0º The same issue may be seen in the example at: https://phaser.io/examples/v2/display/arc -u
  5. ugajin

    gemmatch example

    Found it! I have since found another 'better' method. Kind of obvious too! The first thing That I had done was to ditch the example model and find a version with which I was happier working. This new model wasn't a straight forward swap either. I disliked the template used, and did not like the way the thing behaved on a desktop. I think it may be intended for fullscreen mobile devices. Using the example at https://www.joshmorony.com, I re-wrote the code to fit my own state machine template, The first solution I found worked, but limited moving the conceptual touch grid by units equal to 'GEM_SPACING' dimensions, which in this case is defined by the image dimensions. I replaced the image with my own, which helped resolved the above presenting behaviour. The solution, meant you could only adjust the touch grid column/row position values by whole unit values. However, it required editing just two lines of code. The better solution, placed the conceptual touch grid inside a container group. It required a lot more typing [76 lines were edited], but the result allows pixel perfect positioning, which is what we were aiming for. -u Spoke too soon!
  6. ugajin

    gemmatch example

    I have been looking at this: http://phaser.io/examples/v2/games/gemmatch example. The columns and rows are positioned starting at the game origin, which can cause the sprites to appear off centre, when looked at relative to the canvas/game border. I have aded a couple of lines of code which [visually] centres the 'gems'. The code lets you adjust the GEM_SPACING and/or canvas/game dimension values, and updates the 'gems' [group] [*correction, each 'gem'] anchor value accordingly. However, what I can't seem to do, is to create a margin between the canvas edges and the 'gem' [group], without breaking the code. All suggestions, welcome. Thanks.... -u Correction above in bold. I don't know why this text has strikethrough applied, or why some of the above text does too!
  7. Do you mean this... for (var i=0; i < 2; i++) { console.log('1' + i.toString() + '.a=' + i.toString()); ; } Returns... 10.a=0 11.a=1