T
A
B
A
G
E
O
S



Here is the full code for Seer Battler Slash trial, with updated enemy collision.
Use wasd to move and q to do your special attack.
This game is utilizing the tabageos.loadSpriteSheetAndStart method to effectively safeguard the loading of the game sprite sheet.


Tile art by Ansimuz Character art by Pimen
You can learn from and re-use this code, but not the sprite sheet. Notice that the sprite sheet image is not included as part of what the page gives you.


	
		(function() {
		
		
	var mapin = [  
[ [45,64], [45,64], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [45,64], [45,64], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [45,64], [45,64], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [45,64], [45,64], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [45,64], [45,64], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [45,64], [44,65], [44,65], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [5,8], [0,0], [0,0], [0,0], [0,0], [44,65], [0,0], [0,0], [44,65], [44,65], [44,65], [0,0], [0,0], [5,8], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [45,64], [45,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64] ],
[ [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64] ]
  ];
	var map = [  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [5,8], [0,0], [0,0], [0,0], [0,0], [0,0], [73,4], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [73,4], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64] ],
[ [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65] ]
  ];
	var mapm = [  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [44,65], [44,65], [0,0], [0,0], [73,4], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [44,65], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65], [44,64], [44,65] ],
[ [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64] ]
  ];
	var mapi = [  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [44,65], [0,0], [44,65], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [44,64], [44,64], [44,64], [44,65], [44,65], [44,65], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64] ],
[ [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64] ]
  ];
  
	var mapwh = [  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [5,8], [0,0], [44,64], [44,64], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [44,64], [44,64], [44,64], [0,0], [0,0], [0,0], [5,8], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,64], [44,64], [44,64], [44,64], [44,64], [0,0], [0,0], [0,0], [0,0], [73,4], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,65], [0,0], [0,0], [0,0], [44,65], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64] ],
[ [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [0,0], [0,0], [0,0], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64] ]
  ];
		
	var maper = [  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,65], [0,0], [0,0], [0,0], [0,0], [44,65], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64] ],
[ [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,66], [46,67], [46,66], [46,67], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65], [45,65] ]
  ];
	var mapwl =[  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0] ],
[ [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [0,0], [0,0], [0,0], [0,0], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [0,0], [0,0], [0,0], [0,0], [44,64], [44,64], [44,64], [44,64], [44,64], [0,0], [0,0], [0,0], [0,0], [44,65], [44,64], [44,64], [44,64] ],
[ [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [46,66], [46,67], [46,66], [46,67], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [46,66], [46,67], [46,66], [46,67], [45,64], [45,64], [45,64], [45,64], [45,64], [46,67], [46,66], [46,67], [46,66], [45,64], [45,64], [45,64], [45,64] ]
  ];
	var mapboss = [  
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [45,64], [45,65] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [45,64], [45,65] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [45,64], [45,65] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [45,64], [45,65] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [45,64], [45,65] ],
[ [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [0,0], [44,65], [45,64], [45,64], [45,65] ],
[ [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,65], [0,0], [0,0], [0,0], [0,0], [44,65], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,64], [44,65], [45,64], [45,64], [45,64], [45,65] ],
[ [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,64], [46,65], [46,66], [46,67], [46,66], [46,67], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64], [45,64] ]
  ];
  
		var enemies = [];
		var level = 1;
		var coins = [];
		var coinsCollected = 0;
		var starAnimation;
		var exFactory;
		var _hAlt = 0;
		var _hpt;
		var cRect1;
		var powerbadge = 0;
	
		var exp = 0;
		var overallExp = 0;
		var theDragon;
		var draHealth = 1000;
		var fireBall;
		
		var health = 100;
		var strength = 10;
		var stamina = 10;
		var specialCharge = 10;
		var spct = .10;
		
		var redb;
		var purb;
		var greeb;
		
		var remuin = 0;
		var draSound = 0;
		var lupA = [];
		
			function SeerSlashTrial() { 
                var specs = {gWidth:640, gHeight:128, positionResetSpecifics:this.updatePosition, startWidth:80,statHeight:32,startLocations:new tabageos.MoverPoint(64,96),
				initPlayerPosition:new tabageos.MoverPoint(64,64), cameraFollowOffsetX:-116, camearType:1, 
				tileW:16, tileH:16, rootDivId:"root", cameraWidth:208, cameraHeight:128, gameScale:2, spriteSheetImage: "streamline",
				gameLoop:this.loop, initializationSpecifics:this.setup, controllerDivId:"controller", disableBackgroundAlpha:0};
				
				//to designate that we will use the loadSpriteSheetAndStart method to streamline the loading of the sprite sheet.
				//we put 'streamline' as the spriteSheetImage instead of the actual image file.
				//the loadSpriteSheetAndStart method (at the bottom) will take a split up base64 string of the sheet and re-create it pixel by pixel onto the canvas used as the sprite sheet to draw from.
				
                tabageos.GameSkeleton.call(this, specs);
				_hpt = new tabageos.MoverPoint();
				cRect1 = new tabageos.Rectangle(0,0,16,16);
            }
            SeerSlashTrial.prototype = Object.create(tabageos.GameSkeleton.prototype);
			
			SeerSlashTrial.prototype.setup = function() {
				this.lives = 3;
				this.camera.v.width = 208;
				this.tweenLimitX = 432;
				
				document.getElementById("phld").setAttribute("style", "display:none");
				
				var theButton = document.createElement("a");
				theButton.setAttribute("style","position:absolute;top:0px;left:80px;width:16px;height:16px;cursor:pointer;z-index:9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
				this.container.appendChild(theButton);
				theButton.setAttribute("title", "help");
				theButton.setAttribute("alt", "help");
				theButton.setAttribute("href", "https://ofbitco.in/seerbattleslashhelp");
				theButton.setAttribute("target", "_blank");
				
				var mButton = document.createElement("div");
				mButton.setAttribute("style","position:absolute;top:0px;left:64px;width:16px;height:16px;cursor:pointer;z-index:9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
				this.container.appendChild(mButton);
				mButton.setAttribute("title", "mute/unmute");
				mButton.setAttribute("alt", "mute/unmute");
				mButton.setAttribute("onclick", "tabageos.GameSkeleton.game.muteUnmute()");
				
				var playerAnimation = new tabageos.CanvasAnimation(this._image, this.charLayer, null, 0,0,16, 16);
				
				this.title.floor.copyPixels(this._image, new tabageos.Rectangle(208,976,208,128), new tabageos.MoverPoint());
				this.title.floor.canvas.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: -webkit-crisp-edges;image-rendering: pixelated;image-rendering: crisp-edges;");
		
				this.startButton.innerHTML = "    ";
				
				this.gameOverContainer.floor.copyPixels(this._image, new tabageos.Rectangle(432,976,208,128), new tabageos.MoverPoint());
				
				this.player = new tabageos.WeaponHoldingAttacker(320,64,16,16, mapin,playerAnimation,0,0,16,16,map.length,map[0].length,map, this.controller,[61,133],69,81);//the player is using playersScene for collisions.
               
				playerAnimation.animationSpecs = { 
					"left":[3, [6,3,6,3,6,3,6,3,6,4,6,4,6,4,6,4,6,5,6,5,6,5,6,5,6,6,6,6,6,6,6,6,6,7,6,7,6,7,6,7,6,8,6,8,6,8,6,8,6,9,6,9,6,9,6,9,6,10,6,10,6,10,6,10,6,11,6,11,6,11,6,11,6,12,6,12,6,12,6,12] ],
					"right":[3, [4,3,4,3,4,3,4,3,4,4,4,4,4,4,4,4,4,5,4,5,4,5,4,5,4,6,4,6,4,6,4,6,4,7,4,7,4,7,4,7,4,8,4,8,4,8,4,8,4,9,4,9,4,9,4,9,4,10,4,10,4,10,4,10,4,11,4,11,4,11,4,11,4,12,4,12,4,12,4,12] ],
					"up":[17, [1,17,1,17,1,17,1,17] ],
					"down":[19, [1,19,1,19,1,19,1,19] ],
					"upleft":[14, [2,14,2,14,2,14,2,14,2,15,2,15,2,15,2,15,2,16,2,16,2,16,2,16,2,17,2,17,2,17,2,17] ],
					"upright":[14, [1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17] ],
					"downleft":[18, [2,18,2,18,2,18,2,18,2,19,2,19,2,19,2,19] ],
					"downright":[19, [1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,18,1,18,1,18,1,18] ],
					"rightidle":[3, [2,3,2,3,2,3,2,3,2,4,2,4,2,4,2,4,2,5,2,5,2,5,2,5,2,6,2,6,2,6,2,6,2,7,2,7,2,7,2,7,2,8,2,8,2,8,2,8,2,9,2,9,2,9,2,9,2,10,2,10,2,10,2,10] ],
					"leftidle":[3, [1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10] ],
					"upidle":[3, [2,3,2,3,2,3,2,3] ],
					"downidle":[3, [2,3,2,3,2,3,2,3] ],
					"idle":[3, [2,3,2,3,2,3,2,3] ],
					"attackleft":[3, [14,3,14,3,14,3,14,3,14,4,14,4,14,4,14,4,14,5,14,5,14,5,14,5,14,6,14,6,14,6,14,6,14,7,14,7,14,7,14,7,14,8,14,8,14,8,14,8,14,9,14,9,14,9,14,9,14,10,14,10,14,10,14,10] ],
					"attackright":[3, [12,3,12,3,12,3,12,3,12,4,12,4,12,4,12,4,12,5,12,5,12,5,12,5,12,6,12,6,12,6,12,6,12,7,12,7,12,7,12,7,12,8,12,8,12,8,12,8,12,9,12,9,12,9,12,9,12,10,12,10,12,10,12,10] ],
					"attackleftidle":[3, [14,3,14,3,14,3,14,3,14,4,14,4,14,4,14,4,14,5,14,5,14,5,14,5,14,6,14,6,14,6,14,6,14,7,14,7,14,7,14,7,14,8,14,8,14,8,14,8,14,9,14,9,14,9,14,9,14,10,14,10,14,10,14,10] ],
					"attackrightidle":[3, [12,3,12,3,12,3,12,3,12,4,12,4,12,4,12,4,12,5,12,5,12,5,12,5,12,6,12,6,12,6,12,6,12,7,12,7,12,7,12,7,12,8,12,8,12,8,12,8,12,9,12,9,12,9,12,9,12,10,12,10,12,10,12,10] ], 
					"duckright":[8, [19,8,19,8,19,8,19,8,19,9,19,9,19,9,19,9,19,10,19,10,19,10,19,10,19,11,19,11,19,11,19,11] ],
					"duckleft":[8, [20,8,20,8,20,8,20,8,20,9,20,9,20,9,20,9,20,10,20,10,20,10,20,10,20,11,20,11,20,11,20,11] ],
					"chargeleft":[3, [10,3,10,3,10,3,10,3,10,4,10,4,10,4,10,4,10,5,10,5,10,5,10,5,10,6,10,6,10,6,10,6,10,7,10,7,10,7,10,7,10,8,10,8,10,8,10,8,10,9,10,9,10,9,10,9,10,10,10,10,10,10,10,10,10,11,10,11,10,11,10,11,10,12,10,12,10,12,10,12] ],
					"chargeright":[3, [7,3,7,3,7,3,7,3,7,4,7,4,7,4,7,4,7,5,7,5,7,5,7,5,7,6,7,6,7,6,7,6,7,7,7,7,7,7,7,7,7,8,7,8,7,8,7,8,7,9,7,9,7,9,7,9,7,10,7,10,7,10,7,10,7,11,7,11,7,11,7,11,7,12,7,12,7,12,7,12] ] 
				};
				
				playerAnimation.fromWidthOffset = 56 - 16;
				playerAnimation.fromHeightOffset = 48 - 16;
				playerAnimation.fromXOffset = (56 - 16);
				playerAnimation.fromYOffset = (48-16);
				this.player._autoAnimationThrottle = 1;
				this.player.attackWidthOffset = 40;
				this.player.attackHeightOffset = 48-16;
				
				this.player.crouchHeightOffset = 48-16;
				this.player.crouchWidthOffset = 39;
				
				this.player.attackTwoWidthOffset = 40;
				this.player.attackTwoHeightOffset = 48 - 16;
				
				playerAnimation.currentAnimation = "right";
				playerAnimation.animate();
				this.player.attackTwoName = "charge";

				this.player._walkSpeed = 4;
                this._cameraType = 1;
				
                this.controller.basicArrows.d = 77;
				this.controller.basicWasd.d = 77;
				
				tabageos.BlitMath.ignoredArrays = [[73,4], [5,8]];
				tabageos.BlitMath.specificPatternBlit(this.display, this._image, mapin);
				
				this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(896,864,191,224),new tabageos.MoverPoint(0,0));
				
				this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(896,864,191,224),new tabageos.MoverPoint(191,0));
				
				this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(1152,944,208,128),new tabageos.MoverPoint(96,0));
				
				this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(896,864,191,224),new tabageos.MoverPoint(382,0));
				this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(896,864,191,224),new tabageos.MoverPoint(573,0));
				
				enemies = this.changeSceneEnemies(1);
				
				this.player.personalSpace = 56;
				
				this.sceneChanger.addScene(mapin);
				this.sceneChanger.addScene(map);
				this.sceneChanger.addScene(maper);
				this.sceneChanger.addScene(mapwh);
				this.sceneChanger.addScene(mapm);
				this.sceneChanger.addScene(mapi);
				this.sceneChanger.addScene(map);
				this.sceneChanger.addScene(mapm);
				this.sceneChanger.addScene(mapi);
				this.sceneChanger.addScene(mapwh);
				this.sceneChanger.addScene(maper);
				this.sceneChanger.addScene(mapwl);
				this.sceneChanger.addScene(map);
				this.sceneChanger.addScene(mapboss);
				
				this.sceneChanger.changeCurrentMap(1);
				
				tabageos.BlitMath.functionAssignments = [[73,4], [5,8]];
				tabageos.BlitMath.dispatchFunctionAssignments(this.screenOrganizer, "sceneSetup",this,this.sceneChanger.currentMap,16,16);
				
				this.player._map = tabageos.BlitMath.replaceValuesFromMultiArray(this.player._map, [ [46,66], [46,67], [46,66], [46,67] ] , 0,0 );
				
				this.priorToSceneChange = this.beforeSceneChange;
				this.afterSceneChange = this.sceneChangePositionUpdate;
				this.sceneChangeSpecifics = this.sceneSetup;
				
				var draa = new tabageos.CanvasAnimation(this._image, this.charLayer,new tabageos.Rectangle(192,0,192,144),0,0,192,144);
				draa.defineAnimation("fly", [1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0]);
				draa.defineAnimation("shoot", [9,0]);
				draa.defineAnimation("hurt", [8,1]);
				draa.currentAnimation = "fly";
				
				theDragon = new tabageos.MapTraveler(0,0,192,144,mapboss,draa);
				
				fireBall = new tabageos.BlittedTraveler(this._image,this.charLayer,new tabageos.Rectangle(1264,160,64,32),0,0,64,32);
				fireBall.defineAnimation("go",[79,10,83,10,87,10]);
				fireBall.currentAnimation = "go";
				fireBall.fromXOffset = -48;
				fireBall.fromYOffset = -16;
				
				fireBall.x = -700;
				
				exFactory = new tabageos.ExplosionFactory(16,16,5,512,16);
				
				this.hideHUD();
				this._playerHUD.style.display = "inline";
				
				this._healthBar.setAttribute("id", "barHolder");
				
				redb = document.createElement("div");
				redb.setAttribute("id", "redBar");
				this._healthBar.appendChild(redb);
				
				purb = document.createElement("div");
				purb.setAttribute("id", "purpleBar");
				this._healthBar.appendChild(purb);
				
				greeb = document.createElement("div");
				greeb.setAttribute("id", "greenBar");
				this._healthBar.appendChild(greeb);
				
				redb.setAttribute("style", "position:absolute;left:0px;top:0px;width:10px;height:5px");
				purb.setAttribute("style", "position:absolute;left:0px;top:5px;width:10px;height:5px");
				greeb.setAttribute("style", "position:absolute;left:0px;top:10px;width:1px;height:5px");
				
				this.hideHealthBar();
				
				this.fullResetSpecifics = function(e) {
					remuin = 0;
					coins.length = 0;
					specialCharge = 1;
					draHealth = 1000;
					this.sceneChanger.clearAllArrays();
					
				};
				
				this.beforeStartGameLoop = function(e) {
					this.playMusic("PreparingForBattle");
					
				};
				
            };
			// tabageos.GameSkeleton._str[7]= holds part of the base64 of the sprite sheet.
			SeerSlashTrial.prototype.beforeSceneChange = function(scene) {
			
				enemies = this.changeSceneEnemies(scene);
				
			};
			SeerSlashTrial.prototype.sceneChangePositionUpdate = function(direc) {
				
				if(!remuin) {
					
					this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(896,864,191,224),new tabageos.MoverPoint(0,0));
					this.backgroundLayer.copyPixels(this._image, new tabageos.Rectangle(896,864,191,224),new tabageos.MoverPoint(191,0));
					remuin = 1;
					
				}
				
				if(this.player.x > 208) {
					this.camera.v.x = 640 - 208;
					this.cameraPoint.x = Math.round(this.player.x) - -32; 
					this.callCamera();
				} else {
				
					this.player.setX(32);
				
				}
				
				var playersScene = tabageos.BlitMath.replaceValuesFromMultiArray(this.sceneChanger.currentMap,[ [73,4], [46,66], [46,67], [46,66], [46,67] ]);
				this.player._map = playersScene;
				var i = 0;var en;
				
				for(i;i<enemies.length;i++) {
					en = enemies[i];
					en._map = this.player._map;
				}
				
				if(draSound == 1) {
					draSound = 0;
					this.playMusic("PreparingForBattle");
				}                                                                 
				
			};
			SeerSlashTrial.prototype.sceneSetup = function(e) {
				
				var en;var enAni;
				
				if(e.tileValue[0] == 5 && e.tileValue[1] == 8) {
					
					var ht = new tabageos.CanvasAnimation(this._image,this.charLayer,null,0,0,16,16);
					ht.animationSpecs = {"heart":[5, [8,5] ] };
					ht.currentAnimation = "heart";
					ht.x = e.x; ht.y = e.y;
					coins.push(ht);
					this.sceneChanger.currentMap[e.tileYIndex][e.tileXIndex] = [0,0];
					this.player._map[e.tileYIndex][e.tileXIndex] = [0,0];
					
				}
				if(e.tileValue[0] == 73 && e.tileValue[1] == 4 && enemies.length <= 9) {
				
					
					enAni = new tabageos.CanvasAnimation(this._image,this.charLayer,new tabageos.Rectangle(e.tileValue[1]*this.tileWidth,e.tileValue[0]*this.tileHeight,this.tileWidth,this.tileHeight),e.tileXIndex*this.tileWidth,e.tileYIndex*this.tileHeight,this.tileWidth,this.tileHeight);
					enAni.animationSpecs = { 
						"left":[18, [4,18,4,18,4,18,4,18,5,18,5,18,5,18,5,18,6,18,6,18,6,18,6,18,7,18,7,18,7,18,7,18,8,18,8,18,8,18,8,18,9,18,9,18,9,18,9,18] ],
						"right":[17, [4,17,4,17,4,17,4,17,5,17,5,17,5,17,5,17,6,17,6,17,6,17,6,17,7,17,7,17,7,17,7,17,8,17,8,17,8,17,8,17,9,17,9,17,9,17,9,17] ], 
						"hurtleft":[18, [10,18,10,18,10,18,10,18] ],
						"hurtright":[17, [10,17,10,17,10,17,10,17] ]
					};
					enAni.currentAnimation = "right";
					enAni.fromWidthOffset = 56-16;
					enAni.fromHeightOffset = 48-16;
					enAni.fromXOffset = 56-16;
					enAni.fromYOffset = 48-16;
					en = new tabageos.MapTraveler(e.tileXIndex*this.tileWidth,e.tileYIndex*this.tileHeight,56,48, this.player._map, enAni, 1,this.player._deltaTime,this.tileWidth,this.tileHeight,this.player._map.length, this.player._map[0].length);
					en._jumps = 1;
					en.health = 25;
					
					en._walkSpeed = 1;
					en.maxSpeed = 2;
					en.maxForce = 5;
					en.separationDistance = 0;
					en.setX( e.tileXIndex*16 ); en.setY( e.tileYIndex* 16);
					en._map = this.player._map;
					enemies.push(en);
					
					this.player._map[e.tileYIndex][e.tileXIndex] = [0,0];
				
				}
				
				
				
			};
			// tabageos.GameSkeleton._str[8]= holds part of the base64 of the sprite sheet.
			SeerSlashTrial.prototype.placeCoin = function(x,y) {
				
				starAnimation = new tabageos.CanvasAnimation(this._image,this.charLayer,null,0,0,16,16);
				starAnimation.animationSpecs = {"spin":[4, [3,4,3,4,3,4,3,4,4,4,4,4,4,4,4,4,5,4,5,4,5,4,5,4,6,4,6,4,6,4,6,4] ] };
				starAnimation.currentAnimation = "spin";
				starAnimation.x = x; starAnimation.y = y;
				coins.push(starAnimation);
				
			};
			SeerSlashTrial.prototype.placeHeart = function(x,y) {
				
				var ht = new tabageos.CanvasAnimation(this._image,this.charLayer,null,0,0,16,16);
					ht.animationSpecs = {"heart":[5, [8,5] ] };
					ht.currentAnimation = "heart";
					ht.x = x; ht.y = y;
					coins.push(ht);
				
			};
			SeerSlashTrial.prototype.updatePosition = function(e) {
			
				this.player.setX(64);
				this.player.setY(64);
				this.camera.v.x = 0;
				this.camera.v.y = 0;
				this.callCamera();
			
			};
			// tabageos.GameSkeleton._str[9]= holds part of the base64 of the sprite sheet.
			SeerSlashTrial.prototype.levelUp = function(ts) {
				
				if(this._helperPoint.x == -717) {
					
					tabageos.TweenMath.tweenArray(-70,0,3500,"OutBounce",0,lupA);
					
					this._helperPoint.x = 0;
					strength += 2;
					stamina += 1;
					spct += .07;
					
				}
				
				if(lupA.length) {
					
					this._helperRect.x = 1152;
					this._helperRect.y = 608;
					this._helperRect.width = 208;
					this._helperRect.height = 144;
					
					this._helperPoint.x = 0;
					this._helperPoint.y = lupA.shift();
					
					this.callCamera(ts);
					this.cameraLayer.copyPixels(this._image, this._helperRect, this._helperPoint);
					
					if(lupA.length <= 0) {
						
						this._doAlternate = 0;
						
					}
					
				}
				
			};
			
			SeerSlashTrial.prototype.showEnding = function(ts) {
				
				if(this._helperPoint.x == -717) {
					
					tabageos.TweenMath.tweenArray(-70,0,7500,"OutBounce",0,lupA);
					this._helperPoint.x = 0;
					strength += 2;
					stamina += 1;
					spct += .07;
				}
				
				if(lupA.length) {
					
					this._helperRect.x = 1392;
					this._helperRect.y = 624;
					this._helperRect.width = 208;
					this._helperRect.height = 128;
					
					this._helperPoint.x = 0;
					this._helperPoint.y = lupA.shift();
					
					this.callCamera(ts);
					this.cameraLayer.copyPixels(this._image, this._helperRect, this._helperPoint);
					
				}
				
			};
			
			SeerSlashTrial.prototype.loop = function() {
				
				if(!this.healthBarDisplayed) {
					this.showHealthBar(health,0,0,0,"position:absolute;top:0px;left:0px;height:16px; width:96px;");
					redb.style.width = Math.floor(health / 15.625) + "px";//max 1000 health.
				}
				
				if(specialCharge < 78) {
					specialCharge += spct;
					purb.style.width =  Math.round(specialCharge) + "px";
				}
				
				var cb = this.controller.buttons;
				if(!cb.c || specialCharge < 78) {
					cb.c = 0;
					this.player.move(cb.left, cb.right, cb.up || cb.a,cb.down);
					
				} 
				
				if(cb.d) {
					cb.d = 0;
					this.muteUnmute();
				}
				
				var i = 0; var obj; var l = enemies.length;
				
				if(  specialCharge >= 78 && this.player._canvasAnimation.currentAnimation.indexOf("charge") != -1 && (this.player._canvasAnimation.ani == 32) ) { //atApexOfAttack is a few frames, the middle portion of the animation, use dev tools to see which ones, and pick one if you want presisely just 1 attack, in this case 21 is the frame.
					
					specialCharge = 1;
					purb.style.width =  Math.round(specialCharge) + "px";
					
					var cura = this.player._canvasAnimation.currentAnimation;
					cRect1.x = this.player.x + (cura.indexOf("right") != -1 ? 10 : -56 + 9 );
					cRect1.y = this.player.y - 18;
					cRect1.width = 56;
					cRect1.height = 32;
					
					var rhit = Math.random() * 4;
					if(rhit >= 3) { rhit = 51; }
					
					
					exFactory.addExplosion(this.player.x + (cura.indexOf("right") != -1 ? 10 : -56 + 9 ),this.player.y - 18,0,cura.indexOf("right") != -1 ? 448 : 504 ,cura.indexOf("right") != -1 ? 160 : 160,56,32, .2 );
					this.playSound("spell_02");
					
					if(this.sceneChanger.currentScene == 14 && tabageos.GeometricMath.rectanglesOverlapAmount(cRect1, theDragon.getRectangle()) >= 2) {
						
						draHealth -= (5*strength);
						theDragon._canvasAnimation.currentAnimation = "hurt";
						theDragon._canvasAnimation.animate();
						theDragon._canvasAnimation.blit();
						
						if(draHealth <= 1) {
							
							this._helperPoint.x = -717;
							this.player._canvasAnimation.x = this.player.x+1-1;
							this.player._canvasAnimation.y = this.player.y+1-1;
							this.player._canvasAnimation.blit(0,0,0);
							this.levelComplete(this.showEnding);
							return;
							
							
						} else {
							
							theDragon._canvasAnimation.delayedAnimateAndBlit(.2,1000,"fly");
							
						}
					}
					
					
					i = 0;
					for(i; i < enemies.length;i++) {
						obj = enemies[i];
						
						if(tabageos.GeometricMath.rectanglesOverlapAmount(cRect1, obj.getRectangle())/16 >= 2) {
							var xer = cRect1.x + cRect1.width;
							var xel = cRect1.x;
								
								obj.health -= 24 + (strength/10);
								cRect1.x = obj.x + (obj.width * .5);
								cRect1.y = obj.y - (16/2);
								cRect1.width = obj.health;
								cRect1.height = 3;
								this.charLayer.drawRect(cRect1, "#ff0000");
								
								obj._canvasAnimation.currentAnimation = "hurt"+obj._canvasAnimation.currentAnimation.replace("hurt","");
								
								obj.setX(cura.indexOf("right") != -1 ? obj.x+32 : obj.x-32);
								
								if(obj.health <= 0) {
								
									if( !powerbadge ) {  //powerbadge
										powerbadge = 1;
										
										//badge
									
									}
									exp += 100;
									greeb.style.width = Math.floor(exp / 15.625) + "px";
									exFactory.addExplosion(obj.x, obj.y, 1, 168,0,56,112,.5);
									this.placeCoin(obj.x + 16,obj.y+obj.height - 16);
									tabageos.GeometricMath.splice(enemies, enemies.indexOf(obj)); break;
								}
						
						
						
						}
					}
					
					
					this.player._canvasAnimation.currentAnimation = this.player._canvasAnimation.currentAnimation.replace("charge", "");
					this.player._canvasAnimation.animate();
					this.player._canvasAnimation.blit();
					
					cb.c = 0;
				} 
				
				if ( this.player._canvasAnimation.ani == 20 && this.player._canvasAnimation.currentAnimation.indexOf("attack") != -1 ) {
					
					this.playSound("hit_04");	
				}
				
				i = 0;var oneIsAttacking = 0;
				for(i; i < enemies.length;i++) {
				
					obj = enemies[i];
					
					if(!oneIsAttacking && tabageos.GeometricMath.testForPointInCircle(obj._pos,100,this.player._pos) && !obj._pRight && !obj._pLeft) {
							_hpt.x = !this.player._leftRightFace ? this.player.x - (obj.width-16) : this.player.x+1-1; _hpt.y = obj.y+1-1;
							
							obj.easeTo(_hpt);
							
							obj.update(0,0,obj.flyPassWall);
							
							if(obj.x < this.player.x) {
								obj.dX = 0;
							} else if (obj.x > this.player.x + this.player.width) {
								obj.dX = 1; 
							}
							oneIsAttacking = 1;
					} else {
							obj.separationDistance += 1;
							
							if(obj._pRight || obj.x > this.gameWidth - 16 || (obj.dX == 0 && obj.separationDistance >= 120)) {
								obj.dX = obj._pLeft ? 0 : 1;
								obj.separationDistance = 0;
								
							} else if (obj._pLeft || obj.x < 16 || (obj.dX == 1 && obj.separationDistance >= 120)) {
								obj.dX = 0;
								obj.separationDistance = 0;
							}
							obj.move(obj.dX,obj.dX ? 0 : 1,0,0,0,obj.flyPassWall);
					}
					
					if(obj._canvasAnimation.animationSpecs.left) {
						obj._canvasAnimation.currentAnimation = (obj._veloc.x < 0) ? "left" : (obj._veloc.x >= 1 ? "right" : obj._canvasAnimation.currentAnimation+"");
					}
					
					if(obj._canvasAnimation.animationSpecs.attackleft && obj._canvasAnimation.animationSpecs.attackright) {
						if(tabageos.GeometricMath.testForPointInCircle(obj._pos,16*3,this.player._pos)) {
							obj._canvasAnimation.currentAnimation = obj.dX == 1 ? "attackleft" : "attackright";
						}
					}
					
					var seepr = this.player.getRectangle();
					seepr.y -= (this.player._canvasAnimation.fromHeightOffset - (this.player.height));
					seepr.height += (this.player._canvasAnimation.fromHeightOffset - (this.player.height));
				
					if(tabageos.GeometricMath.rectanglesOverlapAmount(obj.getRectangle(), seepr )/seepr.width >= 2) {
					
						if( tabageos.GeometricMath.rectanglesOverlapAmount(obj.getRectangle(), seepr )/seepr.width >= 30  && this.player.hurt == 0 && this.player._canvasAnimation.currentAnimation.indexOf("dash") == -1 && this.player._canvasAnimation.currentAnimation.indexOf("attack") == -1 ) {  //advancedAttacker hits with attack explosions, so for example can get hit while at the start of swinging sword, hits count when sword swipe animation is at the defined frame
							this.player.hurt = 3999;
							
							health -= (obj.health * .51);
							health += (stamina/500); 
							this.showHealthBar(health,0,0,0,"position:absolute;top:0px;left:0px;height:16px; width:96px;");
							this.player._grounded = 0; this.player._veloc.y = -2;this.player._state = 3;
							redb.style.width = Math.floor(health / 12.82) + "px";
							if(healthə ) {
								
								this.gameOver(); 
								health = 30;
								return;
							}
							
						} else {
						
							if( this.player._canvasAnimation.currentAnimation.indexOf("dash") != -1 && obj._canvasAnimation.currentAnimation.indexOf(this.player._canvasAnimation.currentAnimation.indexOf("left") != -1 ? "right" : "left") != -1) {
							
							
								obj.health -= 1;
								cRect1.x = obj.x + (obj.width * .5);
								cRect1.y = obj.y - (16/2);
								cRect1.width = obj.health;
								cRect1.height = 3;
								this.charLayer.drawRect(cRect1, "#ff0000");
								
								if(obj.health <= 0) {exp += 100;greeb.style.width = Math.floor(exp / 15.625) + "px";
									this.placeCoin(obj.x + 16,obj.y+obj.height - 16);
									exFactory.addExplosion(obj.x, obj.y, 1, 168,0,56,112,.5);
									tabageos.GeometricMath.splice(enemies, enemies.indexOf(obj)); break;
								}
							
							
							}
							
							if( this.player._canvasAnimation.ani >= 32 && this.player._canvasAnimation.currentAnimation.indexOf("attack") != -1 && obj._canvasAnimation.currentAnimation.indexOf(this.player._canvasAnimation.currentAnimation.indexOf("left") != -1 ? "right" : "left") != -1) {
							
								obj.health -= 2  + (strength/10);
								cRect1.x = obj.x + (obj.width * .5);
								cRect1.y = obj.y - (16/2);
								cRect1.width = obj.health;
								cRect1.height = 3;
								this.charLayer.drawRect(cRect1, "#ff0000");
								if(this.player._canvasAnimation.currentAnimation.indexOf("right") != -1) {
									obj.setX(this.player.x + this.player.width + obj.width + 1);
								} else {
									obj.setX(this.player.x - obj.width - this.player.width - 4);
								}
								
								obj._canvasAnimation.currentAnimation = "hurt"+obj._canvasAnimation.currentAnimation.replace("hurt","");
								
								if(obj.health <= 0) {exp += 100;
									greeb.style.width = Math.floor(exp / 15.625) + "px";
									var ranpla1 = Math.random() * 4;
									if(ranpla1 >= 3.2) {
										
										this.placeCoin(obj.x + 16,obj.y+obj.height - 16);
									} else {
										this.placeHeart(obj.x + 16,obj.y+obj.height - 16);
										
									}
									exFactory.addExplosion(obj.x, obj.y, 1, 168,0,56,112,.5);
									tabageos.GeometricMath.splice(enemies, enemies.indexOf(obj)); break;
								}
							
							
						
							}
							
							if( this.player._canvasAnimation.ani >= 24 && this.player._canvasAnimation.ani <= 26 && this.player._canvasAnimation.currentAnimation.indexOf("attack") != -1 && obj._canvasAnimation.currentAnimation.indexOf(this.player._canvasAnimation.currentAnimation.indexOf("left") != -1 ? "right" : "left") != -1) {
							
								obj.health -= .5  + (strength/10);
								cRect1.x = obj.x + (obj.width * .5);
								cRect1.y = obj.y - (16/2);
								cRect1.width = obj.health;
								cRect1.height = 3;
								this.charLayer.drawRect(cRect1, "#ff0000");
								
								obj._canvasAnimation.currentAnimation = "hurt"+obj._canvasAnimation.currentAnimation.replace("hurt","");
								
								if(obj.health <= 0) {exp += 100;
									greeb.style.width = Math.floor(exp / 15.625) + "px";
									var ranpla = Math.random() * 4;
									if(ranpla >= 3) {
										
										this.placeHeart(obj.x + 16,obj.y+obj.height - 16);
									} else {
								
										this.placeCoin(obj.x + 16,obj.y+obj.height - 16);
									}
									exFactory.addExplosion(obj.x, obj.y, 1, 168,0,56,112,.5);
									tabageos.GeometricMath.splice(enemies, enemies.indexOf(obj)); break;
								}
							
							
						
							}
							
							
							
						}
						
					
					}
					
					
					obj._canvasAnimation.animate(.7);
					obj._canvasAnimation.x = obj.x+1-1;
                    obj._canvasAnimation.y = obj.y+1-1;
					obj._canvasAnimation.blit(0,0,1);
				
				
				}
				
				i = 0;
				for(i;i<coins.length;i++) {
					obj = coins[i];
					obj.animate();
					obj.blit();
					if(tabageos.GeometricMath.testForPointInCircle(obj.getPosition(),16,this.player._pos)) {
						
						if(obj.currentAnimation == "heart") {
							if(health <= 980) {
								health += 20; 
							}
							redb.style.width = Math.floor(health / 15.625) + "px";
							this.showHealthBar(health,0,0,0,"position:absolute;top:0px;left:0px;height:16px; width:96px;");
							tabageos.GeometricMath.splice(coins, coins.indexOf(obj));
							break;
							
						}
						
						coinsCollected += 1;

						tabageos.GeometricMath.splice(coins, coins.indexOf(obj));break;
						
					}
					
					
					
				}
				
				
				if(exp >= 1000 && exp % 1000 == 0) {
					this._helperPoint.x = -717;
					exp = 100;overallExp += 1000;
					greeb.style.width = Math.floor(exp / 15.625) + "px";
					this.levelComplete(this.levelUp);
					return;
					
				}
				
				if(this.sceneChanger.currentScene == 14) {
					if(draSound == 0) {
						draSound = 1;
						this.playMusic("EpicBossBattle");
						
					}
					
					theDragon.x = 640 - 16 - 192 -16;
					theDragon.y = -48;
					theDragon._canvasAnimation.x = theDragon.x;
					theDragon._canvasAnimation.y = theDragon.y;
					if(!theDragon._canvasAnimation._inDelay) {
						theDragon._canvasAnimation.animate(.2);
					}
					theDragon._canvasAnimation.blit();
					
					if(this.player.hurt == 0 && tabageos.GeometricMath.rectanglesOverlapAmount(theDragon.getRectangle(), this.player.getRectangle()) >= 64) {
						this.player.hurt = 3999;
						health -= 50;health += (stamina/500); 
						if(health < 1) {
							
							this.gameOver();
							health = 30;
							return;
						}
						
						
					}
					
					if(fireBall.x <= -64) {
						fireBall.setX( theDragon.x - 32 );
						fireBall.setY( theDragon.y + 58  );
						fireBall.easeTo(this.player._pos);
						this.playSound("spell_fire_05");
					}
					fireBall.animate();
					fireBall.move();
					fireBall.blit();
					
					
					if(this.player.hurt == 0 && tabageos.GeometricMath.rectanglesOverlapAmount(fireBall.getRectangle(), this.player.getRectangle()) >= 1 ) {
						this.player.hurt = 3999;
						health -= 35;health += (stamina/500); 
						if(health < 1) {
							
							this.gameOver();
							health = 30;
							return;
						}
						
						
					}
					
				}
				
				if(this.player.y > 128) {
					
					this.gameOver();
					health = 30;
					return;
				}
				
				
				this.player._canvasAnimation.changeDirectionAnimation(cb.left,cb.right,this.player._veloc.y < 0,this.player._veloc.y >= 1);
				
				
				this.player._canvasAnimation.animate(this.player._canvasAnimation.currentAnimation.indexOf("attack") != -1 ? 1 : .5);
				
				if(this.player.hurt > 0) { this.player.hurt -= 33.3;
					if(_hAlt == 1) {
                        this.player._canvasAnimation.x = this.player.x;
						this.player._canvasAnimation.y = this.player.y;
						this.player._canvasAnimation.blit(0,0,0); _hAlt = 0;
					} else { _hAlt += 1; }
				} else { this.player.hurt = 0;
                        this.player._canvasAnimation.x = this.player.x+1-1;
						this.player._canvasAnimation.y = this.player.y+1-1;
						this.player._canvasAnimation.blit(0,0,0);
				}
				
				if(cb.c && this.player._canvasAnimation.finishedCurrentAnimation()) {
					cb.c = 0;
				}
				
				
				exFactory.displayExplosions(this.charLayer,this._image, 1);
			
			};
			
			//builds the actual sprite sheet pixel by pixel from the split base64.
			//gameSpriteSheet is just a dummy file.
			tabageos.loadSpriteSheetAndStart("gameSpriteSheet.png", 2000, 1200, function(e) {
				
				new SeerSlashTrial();
				
			});
		})();
	
	



back to top