JSFiddle - React, Tailwind, and code Playground

by InferOn

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.min.js"></script>
<DIV id="gameStage">

</DIV>

JavaScript

var game = new Phaser.Game(1200, 600, Phaser.CANVAS, 'gameStage', {
  preload: preload,
  create: create,
  update: update
});
var prevHole = 3;

function preload() {
  game.load.image('bloxoDown', '../bloxo/assets/images/bloxoDown.png');
  game.load.image('bloxoUp', '../bloxo/assets/images/bloxoUp.png');
  game.load.image('wall', '../bloxo/assets/images/platform.png', 400, 200);

  var space;
  var esc;
  var player;
  var walls;
  var score;
}

function create() {

  //Canvas With a White Bacground and Physics is Created
  game.stage.backgroundColor = "#ffffff";
  game.physics.startSystem(Phaser.Physics.ARCADE);


  //Sets the initial Score.
  score = 0;

  //Sets how fast the tiles move
  tileSpeed = -300;

  tileWidth = game.cache.getImage('wall').width;
  tileHeight = game.cache.getImage('wall').height;;

  //Keys for User Input are created
  space = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
  esc = game.input.keyboard.addKey(Phaser.Keyboard.ESC);

  //Adds Bloxo to the game as a sprite.
  player = game.add.sprite(200, 200, 'bloxoDown');
  player.scale.setTo(0.6, 0.6);
  game.physics.enable(player, Phaser.Physics.ARCADE);
  player.body.collideWorldBounds = true;
  player.body.immovable = true;

  //Walls Group is created
  walls = game.add.physicsGroup();
  walls.createMultiple(50, 'wall');
  walls.enableBody = true;


  game.physics.arcade.overlap(player, walls, null, this)

  
  //  Stop the following keys from propagating up to the browser
  game.input.keyboard.addKeyCapture([Phaser.Keyboard.SPACEBAR, Phaser.Keyboard.ESC, ]);

  //Unpausing Function
  window.onkeydown = function(event) {
    if (esc.onDown && (esc.timeDown > 2000)) {
      if (game.paused) {
        game.paused = !game.paused;
        pauseLbl.destroy();
      }
    }
  }

  //Add an initial platform
  addWall();

  //Add a platform every 3 seconds
  var timerWorld = game.time.events.loop(500, addWall);
}

function update() {

  if (space.isDown) {
    player.body.y -= 5;
   ...