Search the Community
Showing results for tags 'spitesheet'.
I have the animation of hero in one spritesheet file: spritesheet1.png preload: game.load.atlasJSONHash('spritesheet1', 'assets/entities/spritesheet1.png', 'assets/entities/spritesheet1.json');create: var hero = game.add.sprite(100, 100, 'spritesheet1');hero.animations.add('animName1', Phaser.Animation.generateFrameNames('animName1_', 0, 16, '', 4), 30);hero.animations.play('animName1', 30, true); also I have the "health bar" at that spitesheet1.png How is better to add that sprite from spritesheet? I do like that: var healthBar = game.add.sprite(250, 270, 'spritesheet1');healthBar.animations.add('healthBar', Phaser.Animation.generateFrameNames('healthBar_', 0, 0, '', 4), 30);healthBar.animations.play('healthBar');and I think that it's no a good way, may be is there a simple way to do? Yes, I know that I can load the healtBar as separate image (healthBar.png), but I want to keep all art in one spritesheet.