Cube from Blender in Phaser
by Ivan Enzhaev
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.min.js"></script>
<div id="game_div"> </div>
CSS
#game_div {
width: 400px;
margin: auto;
margin-top: 20px;
}
JavaScript
// Initialize Phaser, and creates a 400x490px game
var game = new Phaser.Game(400, 400, Phaser.AUTO, 'game_div');
var gameState = {};
// Creates a new 'main' state that wil contain the game
gameState.main = function() {};
gameState.main.prototype = {
// Function called first to load all the assets
preload: function()
{
game.load.image('hello', 'https://s3.amazonaws.com/uploads-1969f46zwpmbh5cm3kr2/hello.png');
},
create: function()
{
// Function called after 'preload' to setup the game
this.cubeSprite = game.add.sprite(0, 150, 'hello');
},
update: function()
{
// Function called 60 times per second
//this.cubeSprite.angle += 1;
}
};
game.state.add('main', gameState.main);
game.state.start('main');