Parallax ground image repeating

I need to repeat an image to fill my ground area as I added to the stage like

var firstGround=platforms.create(config.width/2, config.height, 'main');

and changed the size to fill the game stage width as

firstGround.displayWidth=config.width; 

but the image is skewing to fill the area, I need parallax image repeating, how can I achieve it?

Take a look at TileSprites. They sound like what you are looking for. https://labs.phaser.io/edit.html?src=src/game%20objects/tile%20sprite/Example.js
https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.TileSprite.html

I’m a newbie, is TileSprites static?
as
platforms = this.physics.add.staticGroup()

A TileSprite is just like any other GameObject (a Sprite, an Image, etc…). So they can be used in an Arcade Physics group as static bodies :slight_smile:

1 Like

Thanks

var mainGround = this.add.tileSprite(0, 0, config.width, 100, ‘main’);
this.physics.add.existing(mainGround, true);

this worked for me.

1 Like