"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var key = 'boySprite';
/**
 * 
 * @param {Phaser.Scene} scene 
 */

function loadSprite(scene) {
  scene.load.spritesheet(key, require('../assets/boy-char.png'), {
    frameWidth: 256,
    frameHeight: 256
  }); // var shardsImg = new Image();
  // shardsImg.onload = () => {
  //   scene.textures.addSpriteSheet(key, shardsImg, { frameWidth: 256, frameHeight: 256 });
  // };
  // shardsImg.src = require('../assets/boy-char.png');
}
/**
 * 
 * @param {Phaser.Scene} scene 
 */


function makeAnimation(scene) {
  scene.anims.create({
    key: 'down',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 0,
      end: 4
    }),
    frameRate: 6,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'walking-down',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 5,
      end: 9
    }),
    frameRate: 10,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'up',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 10,
      end: 14
    }),
    frameRate: 6,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'walking-up',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 15,
      end: 19
    }),
    frameRate: 10,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'left',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 40,
      end: 44
    }),
    frameRate: 6,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'walking-left',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 45,
      end: 49
    }),
    frameRate: 10,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'right',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 50,
      end: 54
    }),
    frameRate: 6,
    repeat: -1,
    yoyo: true
  });
  scene.anims.create({
    key: 'walking-right',
    frames: scene.anims.generateFrameNumbers(key, {
      start: 55,
      end: 59
    }),
    frameRate: 10,
    repeat: -1,
    yoyo: true
  });
}
/**
 * 
 * @param {Phaser.Scene} scene 
 */


var _default = {
  loadSprite: loadSprite,
  makeAnimation: makeAnimation
};
exports["default"] = _default;