//--------------------Game--------------------
// Classes
const Menus = new Menu();
const button = new Button();
const DB = new database();
// Game variables
const width = window.innerWidth;
const height = window.innerHeight;
let requesteddata = [];
let buttonWidth = width / 6
let buttonHeight = buttonWidth / 5
// Menu variables
let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
let currentIndex = [0, 0, 0];
let nameHS = '';
let pressed = false;
let searchName = '';
let dataIsCalled = false;
let clearDataOnce = false;
// Player variables
const playerSize = 10;
let radius = playerSize / 2;
let playerPosX = 500
let playerPosY = 300;
let playerSpeed = 4;
let lives = 1;
let isDead = false;
let bossPosX = width / 2;
let bossPosY = height / 6;
let bossVelX = 5;
let bossVelY = 5;
let shotSpeed = 12;
let shotSpeedAdj;
let projectile;
let projSize = 5;
let shot = false;
let hit = false;
let shotPosX;
let shotPosY;

let initialPlayerPosX = playerPosX;
let initialPlayerPosY = playerPosY;
let bullets = [];
let direction;
let framerate = 120;
let hasMoved = false;
let time = 0;
let shotPoint = 0;
let angle = 0;

let patern;
let paternArray = [];
let suroundX = 300;
let suroundY = 300;
let x2;
let y2;
let x3;
let y3;
let x4;
let y4;
let x5;
let y5;
let homescreenOn = true;
let pausescreenOn = false;
let scorescreenOn = false;
let gamescreenOn = false;
let chosen = false;
let finalPhase = false;
let nextWave = [];
let iIndex = 0;
let buttonSelect = 0;
let entered = false;
let submitted = false;
let keyReleasedFlag = true;
let escaped = false;
let buttonSelectScore = 0;

let bulletAmount = 5;

let phases = [false, false, false, false, false];
