var player = game.spawnPlayerXY('captain', 39, 34);
player.maxHealth = 500;
player.attackDamage = 50;
game.addSurviveGoal(60);
game.addDefeatGoal(2);
game.spawnXY("forest", 36, 30);
game.spawnXY("forest", 40, 30);
game.spawnXY("forest", 44, 38);
game.spawnXY("forest", 45, 30);
game.spawnXY("forest", 44, 46);
game.spawnXY("forest", 28, 30);
game.spawnXY("forest", 28, 39);
game.spawnXY("forest", 44, 54);
game.spawnXY("forest", 36, 53);
game.spawnXY("forest", 27, 54);
game.spawnXY("forest", 26, 60);
game.spawnXY("forest", 18, 54);
game.spawnXY("forest", 19, 30);
game.spawnXY("forest", 19, 39);
game.spawnXY("forest", 19, 22);
game.spawnXY("forest", 19, 14);
game.spawnXY("forest", 27, 13);
game.spawnXY("forest", 54, 30);
game.spawnXY("forest", 62, 30);
game.addMoveGoalXY(73, 58);
var generator = game.spawnXY("generator", 10, 12);
generator.spawnType = "ogre";
generator.spawnDelay = 10;
game.spawnXY("fire-trap", 71, 24);
game.spawnXY("potion-large", 27, 22);
game.spawnXY("gem", 71, 9);
game.spawnXY("gem", 53, 47);
var boss = game.spawnXY("ogre", 64, 53);
boss.maxHealth = 1500;
var enemy = player.findNearestEnemy;
var distance = player.distanceTo(boss);
var fs1 = game.spawnXY("fire-spewer", 44, 61);
fs1.direction="vertical";
var bosshelper = game.spawnXY("soldier", 73, 8);
game.addCollectGoal(2);
game.spawnXY("soldier", 9, 58);
player.maxSpeed = 20;
boss.maxSpeed = 2;
ui.track(player, "health");
ui.setText("levelName","Dylan's Level");
ui.setText("directions", "Welcome to my level! You have to defeat that boss on the other side of that forest, dodge the fireballs! There are helpers scattered around to help you. Your health as you can see is 500, the bosses has 1500 health! Good Luck!");
boss.behavior = "FearsTheLight";
game.spawnXY("lightstone", 71, 38);
boss.attackDamage=25;
When I try to play it right now it’s glitching, can you help. Also I am looking for some interesting unique code that’ll work. Javascript