JSFiddle - React, Tailwind, and code Playground
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 });
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');
}
function create() {
this.projectile=game.add.sprite(100,400,'circle')
this.projectile.touch=function(){
alert('touch')
}
this.axe=game.add.sprite(200,200,'rect')
this.axe.width=300
this.axe.height=10
game.physics.arcade.enable(this.projectile);
game.physics.arcade.enable(this.axe); game.physics.startSystem(Phaser.Physics.ARCADE)
}
function update(){
this.axe.body.rotation += 1; game.physics.arcade.collide(this.axe,this.projectile,this.projectile.touch,null,this)
}
function render(){
game.debug.body(this.projectile);
game.debug.body(this.axe)
}