Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions public/src/game objects/sprites/to json.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
var config = {
type: Phaser.WEBGL,
parent: 'phaser-example',
width: 800,
height: 600,
scene: {
preload: preload,
create: create
class Example extends Phaser.Scene
{
constructor ()
{
super();
}
};

var game = new Phaser.Game(config);
preload ()
{
this.load.image('bunny', 'assets/sprites/bunny.png');
}

function preload ()
{
this.load.image('bunny', 'assets/sprites/bunny.png');
}
create ()
{
const bunny = this.add.sprite(400, 300, 'bunny');

function create ()
{
var bunny = this.add.sprite(400, 300, 'bunny');
// Set a few properties:

// Set a few properties:
bunny.angle = 25;

bunny.angle = 25;
bunny.setScale(1.3);

bunny.setScale(1.3);
bunny.alpha = 0.9;

bunny.alpha = 0.9;
bunny.flipY = true;

bunny.flipY = true;
console.log(bunny.toJSON());

console.log(bunny.toJSON());
// console.log(JSON.stringify(bunny));
}
}

// console.log(JSON.stringify(bunny));
const config = {
type: Phaser.WEBGL,
parent: 'phaser-example',
width: 800,
height: 600,
scene: [Example]
};

}
const game = new Phaser.Game(config);