export enum AtlasMap {
    complete = "sprites/atlas_v16.png",
    wall = "sprites-bubble/object/background.png",
    frame = "sprites-bubble/machine/ui/frame.png",
    startMenuBg = "sprites-bubble/startmenu/background.png",
    startMenuLogo = "sprites-bubble/startmenu/logo.png",
    startMenuButton = "sprites-bubble/startmenu/button_default.png",
    letterBg = "sprites-bubble/letter/background.png",
    letterButton = "sprites-bubble/letter/button.png",
    letterSheet = "sprites-bubble/letter/sheet.png",
    table = "/sprites-bubble/object/table.png",
    floor = "/sprites-bubble/object/floor.png",
    shelf = "/sprites-bubble/object/shelf.png",
    bigplant = "/sprites-bubble/object/bigplant.png",
    cashregister = "/sprites-bubble/object/cashregister.png",
    woman = "/sprites-bubble/character/woman.png",
    man = "/sprites-bubble/character/man.png"
}

export enum PlayerAnim {
  Idle = "idle",
  Run = "run",
  Jump = "jump",
  Fall = "fall",
  Attack = "attack",
  AttackRanged = "attackRanged",
  Crunch = "crunch",
  IdleDuck = "idle-duck",
}

export enum PlayerEffectAnim {
  Effect = "effect",
  EffectRanged = "effectRanged"
}

export enum SpriteType {
  Player = "player",
  PlayerEffect = "playerEffect",
  PlayerEffectRanged = "playerEffectRanged",
  Floor = "floor",
  Chest = "chest",
  Heart = "heart"
}

export interface Anim {
  speed: number;
  from: number;
  to: number;
  loop: boolean;
}

export interface Sprite {
  x: number;
  y: number;
  width: number;
  height: number;
  sliceX: number;
  sliceY?: number;
  anims?: Record<string, Anim>;
}

export const Atlas: Record<SpriteType, Sprite> = {
  [SpriteType.Player]: {
    x: 0,
    y: 0,
    width: 576,
    height: 96,
    sliceX: 18,
    sliceY: 3,
    anims: {
      [PlayerAnim.Idle]: { speed: 10, from: 0, to: 5, loop: true },
      [PlayerAnim.Run]: { speed: 10, from: 6, to: 9, loop: true },
      [PlayerAnim.Jump]: { speed: 10, from: 10, to: 13, loop: true },
      [PlayerAnim.Fall]: { speed: 10, from: 14, to: 17, loop: true },
      [PlayerAnim.Attack]: { speed: 25, from: 18, to: 25, loop: false },
      [PlayerAnim.AttackRanged]: { speed: 18, from: 46, to: 49, loop: false },
      [PlayerAnim.Crunch]: { speed: 10, from: 36, to: 40, loop: true },
      [PlayerAnim.IdleDuck]: { speed: 10, from: 41, to: 45, loop: true },
    },
  },
  [SpriteType.PlayerEffect]: {
    x: 256,
    y: 32,
    width: 256,
    height: 32,
    sliceX: 8,
    anims: {
      [PlayerEffectAnim.Effect]: { speed: 25, from: 0, to: 7, loop: false },
    },
  },
  [SpriteType.PlayerEffectRanged]: {
    x: 448,
    y: 64,
    width: 128,
    height: 32,
    sliceX: 4,
    anims: {
      [PlayerEffectAnim.EffectRanged]: { speed: 18, from: 0, to: 3, loop: false },
    },
  },
  [SpriteType.Floor]: {
    x: 544,
    y: 32,
    width: 32,
    height: 32,
    sliceX: 1,
  },
  [SpriteType.Chest]: {
    x: 544,
    y: 32,
    width: 32,
    height: 32,
    sliceX: 1
  },
  [SpriteType.Heart]: {
    x: 512,
    y: 32,
    width: 32,
    height: 32,
    sliceX: 1,
  },
};
