JSFiddle - React, Tailwind, and code Playground
by espace3d
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/3.16.2/phaser.min.js"></script>
<div id='phaser-example'></div>
JavaScript
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#1b1464',
parent: 'phaser-example',
physics: {
default: 'arcade',
arcade: {
gravity: {
x: 0,
y: 100,
},
debug:true,
}
},
scene: {
preload: preload,
create: create,
update: update
}
};
var game = new Phaser.Game(config);
var o={};
function preload ()
{
this.load.image("block", "https://i.postimg.cc/KvY7DVGx/player.png");
}
function create ()
{
o.g = this.physics.add.group()
o.e = this.physics.add.sprite(100,100,"block").setBounce(1,1)
o.f = this.physics.add.sprite(140,120,"block").setBounce(1,1)
o.g.add(o.e)
o.g.add(o.f)
this.physics.add.collider(o.g, o.g);
}
function update ()
{
}