Combining objects (isometric breakdown) into a phaser and camera positioning

I am new to Phaser and it is currently difficult for me to create a tilemap using the phomet-isometric plugin. I also had trouble understanding some of the concepts associated with the Phaser world, the game and the camera, which further complicate the process of creating tiles. I really noticed that this problem seems to be an obstacle for Phaser newbies like me, and correctly explaining it will certainly help fight this.

How to get there:

I created a tilemap using a for loop using single sprites. The for loop works correctly, and I also implemented a function where I can specify the number of fragments that I want to generate.

{ spawnBasicTiles: function(half_tile_width, half_tile_height, size_x, size_y) { var tile; for(var xx = 0; xx < size_x; xx += half_tile_width) { for(var yy = 0; yy < size_y; yy += half_tile_height) { tile = game.add.isoSprite(xx, yy, 0, 'tile', 0, tiles_group); tile.checkWorldBounds = true; tile.outOfBoundsKill = true; tile.anchor.set(0.5, 0); } } } } 

enter image description here Thus, the process of creating static grass slabs is not a problem. The problem and one of the reasons why I try to work correctly with the pool of objects is when the number of tiles exceeds 80, which greatly affects the performance of the game. Since I am aimed at creating HUGE, automatically generating cards that are displayed in accordance with the position of the player’s character, it is necessary to combine objects. I created a group for these fragments and added properties that, as I thought, would be required so that the tiles that go beyond the limits are not displayed (physics, world borders ...). However, after many attempts, I came to the conclusion that even tiles that are outside the borders are still being created. I also used another property, not add.isoSprite, to generate tiles that were .create but didn't make any difference. I think no tiles are “killed”.

  • Is this process right? What do I need to do to ONLY generate tiles that appear on the camera (I assume the camera is the visible rectangle of the game) and generate the rest when the character moves to another area, assuming that the camera is already tracking the character’s movement?

In addition, I am looking to generate my character in the middle of the world, which is the environment of the generated grass trace. However, it is also difficult for me to do this. I think the following concepts are the ones that I have to play with in order to achieve this, despite the fact that I failed:

  • .anchor.set ()
  • game.world.setBounds (especially this one ... it doesn’t seem to set where I order);
  • Phaser.game (I set my size to window.width and window.height, without having much trouble with this ...)

To summarize : Using the following forloop method to generate tiles, how can I create infinite / almost infinite maps that are generated when the camera that follows my character moves to another region? And besides, what is the right way to always generate my character in the middle of my generated grass map, and also so that the camera starts with a symbol?

I will be very grateful for the help and hope that it can be useful for people in similar situations for mine. For more information, just ask, and if you want the function to create tiles by a specific number, I will gladly send it. Sorry for any language errors.

Many thanks.

EDIT:

I was able to call the character always in the middle of the grass, setting it to X and Y (size / width) and (size / height). Size is a measure of X and Y in px.

+7
javascript isometric phaser-framework
source share

No one has answered this question yet.

See similar questions:

eighteen
The path to the fly and objects: when each of them is useful?

or similar:

2
CanvasJS / HTML5 infinite loop convention. Camera Position Adjustment
one
Tiledmap stays dark after spinning the world in Phaser
0
How to create isometric scenes using Phaser 2
0
Does Phaser provide visible-set sprites to false?
0
Phaser: How to rotate an isometric body?
0
How to properly configure tilemap to display on the lowest layer using Phaser?
0
Where does the tile come from?
0
XNA Isometric Tile Collision
0
Phaser 3 - Lock your camera shape
0
Using multiple layers from Tiled in Phaser

All Articles