You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the columns and rows array defaults to the game origin, which can cause the sprites to appear off centre, when e.g. GEM_SPACING is set to a positive value, and seen relative to the canvas/game border.
I added a couple of lines of code which will [visually] centre the 'gems' to the game. The code lets you adjust the GEM_SPACING and/or canvas/game dimension values, and updates the 'gem' anchor value[s] accordingly.
Also, as part of the exercise, I put the whole code into an 'iife' container to protect the otherwise exposed code.
However, what I can't seem to do, is to create a margin between the canvas edges and the 'gem' array [group] without breaking the code.
I introduced a ‘placeholder sprite and built the gem array using the placholder dimensions, which lets me create an array based on smaller than game world dimensions, But again it defaults to the top left of the game world.
Setting a ‘gems.x’ value, and/or by further tweaking the gem.anchor values makes a mess, and I have tried tracing the 'gem' pipeline with very limited success. I can get the GEMS to fly in from an adjusted position, but that's about it.
I tried posting on the board and got a nil response.
Any help and suggestions, are welcome.
Thank you for considering this.
-u
The text was updated successfully, but these errors were encountered:
I have been looking at: http://phaser.io/examples/v2/games/gemmatch example.
It appears that the columns and rows array defaults to the game origin, which can cause the sprites to appear off centre, when e.g. GEM_SPACING is set to a positive value, and seen relative to the canvas/game border.
I added a couple of lines of code which will [visually] centre the 'gems' to the game. The code lets you adjust the GEM_SPACING and/or canvas/game dimension values, and updates the 'gem' anchor value[s] accordingly.
Also, as part of the exercise, I put the whole code into an 'iife' container to protect the otherwise exposed code.
However, what I can't seem to do, is to create a margin between the canvas edges and the 'gem' array [group] without breaking the code.
I introduced a ‘placeholder sprite and built the gem array using the placholder dimensions, which lets me create an array based on smaller than game world dimensions, But again it defaults to the top left of the game world.
Setting a ‘gems.x’ value, and/or by further tweaking the gem.anchor values makes a mess, and I have tried tracing the 'gem' pipeline with very limited success. I can get the GEMS to fly in from an adjusted position, but that's about it.
I tried posting on the board and got a nil response.
Any help and suggestions, are welcome.
Thank you for considering this.
-u
The text was updated successfully, but these errors were encountered: