Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed with gemmatch example #182

Open
ugajin-nijagu opened this issue Nov 25, 2017 · 0 comments
Open

Help needed with gemmatch example #182

ugajin-nijagu opened this issue Nov 25, 2017 · 0 comments

Comments

@ugajin-nijagu
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant