JSFiddle - React, Tailwind, and code Playground
by espace3d
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.1/phaser.min.js"></script>
JavaScript
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload,create: create, update: update, render: render });
var table
var sprite1
function preload() {
game.load.image('circle', 'https://s13.postimg.org/xjhlzmiev/disc_png.png');
game.load.image('rect', 'http://s10.postimg.org/6fa6mgrd5/motif.jpg');
}
var dim_sprite=100
function create() {
game.physics.startSystem(Phaser.Physics.ARCADE);
sprite1=game.add.sprite(400, 300, 'rect');
sprite1.anchor.x=.5
sprite1.anchor.y=.5
sprite1.width=dim_sprite
sprite1.height=dim_sprite
sprite1.alpha=.1
game.physics.enable(sprite1, Phaser.Physics.ARCADE);
table=[]
for (var j=0; j < 1 ;j++) {
table[j] = game.add.sprite(0, 0, 'circle')
table[j].width = 400
table[j].height = 400
table[j].x = -200
table[j].y = -200 + j * 50
table[j].alpha=1
sprite1.addChild(table[j])
}
console.log(table[0].width)
}
function update() {
sprite1.body.velocity.y = 10
}
function render() {
}