JSFiddle - React, Tailwind, and code Playground

by Dillybob

HTML

<script src="https://cdn.jsdelivr.net/phaser/2.4.3/phaser.min.js"></script>

JavaScript

// Initialize Phaser, and creates a 400x490px game
var game = new Phaser.Game(333, 333, Phaser.WebGL, 'game_div');
var game_state = {};

// Creates a new 'main' state that wil contain the game
game_state.main = function() { };  
game_state.main.prototype = {

    preload: function() { 
		// Function called first to load all the assets
        //game.load.image('hello', 'https://s3.amazonaws.com/uploads-1969f46zwpmbh5cm3kr2/hello.png');
 
    },

    create: function() { 
 
        
       var HP_ORB_WIDTH = 155;
       var HP_ORB_HEIGHT = 135;
        
        
 	 var bmd = game.add.bitmapData((this.game.width, this.game.height));
	 
bmd.context.rect(50,50, HP_ORB_WIDTH, HP_ORB_HEIGHT);

bmd.context.lineWidth = 2;
bmd.context.fillStyle="#e81957";
bmd.context.fillRect(0, 0, HP_ORB_WIDTH, HP_ORB_HEIGHT)

//ctx.globalCompositeOperation = 'destination-atop';
//bmd.context.stroke();
 
	  var   HPORB = game.add.sprite(0,0, bmd);
  
     
 			 //HPORB.scale.x = 1; //facing default direction
  
          
        
        	
      
        
  	game.add.tween(HPORB).to( { height: 0, y: 135 }, 5000, Phaser.Easing.Cubic.Out, true);
       
        
        
        
        
        
        
        
        
        
    },
    
    update: function() {
		// Function called 60 times per second
       // this.hello_sprite.angle += 1;
    },
};

// Add and start the 'main' state to start the game
game.state.add('main', game_state.main);  
game.state.start('main');