Hi,
I can create a grop members from pre loaded images. But when I try this with images from atlas… Desparation!
preload()
{
this.load.atlas('megaset', 'images/spritesheet_2.png', 'images/spritesheet_2.json')
}
create()
{
this.platforms = this.physics.add.staticGroup()
for (let i = 0; i < 8; i++)
{
const x = 128 * i
// const platformImage = this.physics.add.sprite(128 * i, 350, 'megaset').setOrigin(0, 0)
// const platform = this.platforms.create(128 * i, 350, 'platform')
const platform = this.platforms.create({
//classType: this.Phaser.Physics.Arcade.Sprite,
key: 'megaset',
frame: 'grassHalf_mid.png',
setXY: {
x: x,
y: 350
}
})
console.dir(platform)
const body = platform.body
body.updateFromGameObject()
console.dir(body)
}
// this.ground = this.add.image(128, 500, 'megaset', 'grassHalf_mid.png').setOrigin(0, 0)
}
Can anyone help me please. I don’t wanna keep separate files, it kind of makes atlas unnecessery.