JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.4.2/phaser.min.js"></script>
JavaScript
var mainState = {
preload: function() {
// Scale our game
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVeritcally = true;
this.stage.backgroundColor = "#71c5cf";
this.load.image("bird", "assets/bird.png");
},
create: function() {
// create our sprites
this.bird = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, "bird");
this.bird.anchor.setTo(0.5,0.5);
// Detect Input on Screen
this.game.input.onDown.add(this.moveMe, this);
},
update: function() {
},
moveMe: function() {
this.bird.x = this.game.input.x;
this.bird.y = this.game.input.y;
}
};
var game = new Phaser.Game(400, 490, Phaser.AUTO);
game.state.add("main", mainState);
game.state.start("main");