(function() {
//wasd to move
//the array maker tool can be used to create these kinds of arrays from drawn art.
var map1 = [
[ [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [13,11], [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [11,11], [13,11] ],
[ [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11], [13,11] ]
];
var scene;
var enemies = [];
var canShoot = 0;
var projectiles = [];
var movingProjectiles = [];
function IsoGame() {
//even though the map is 640x640, when arranged for iso it will be displayed wider and higher.
//increase game width to see more space on the right.
//increase xOffset during scene construction to see more space on the left.
var specs = {gWidth:1100, gHeight:1100, positionResetSpecifics:null,
initPlayerPosition:new tabageos.MoverPoint(120,120), cameraFollowOffsetX:0, cameraFollowOffsetY:0, camearType:0,
tileW:32, tileH:32, containerDivId:"container", rootDivId:"root", cameraWidth:320, cameraHeight:320, gameScale:0, hudScale:3,spriteSheetImage: "isoPlatSheet.png",
gameLoop:this.loop, initForISO:1, specialControllerUse:0, addedResizeMethod:this.afterResizing, useSceneChanger:0,
controllerHeight:250, initializationSpecifics:this.init, controllerDivId:"controller", disableBackgroundAlpha:0};
tabageos.GameSkeleton.call(this, specs);
};
IsoGame.prototype = Object.create(tabageos.GameSkeleton.prototype);
IsoGame.prototype.init = function() {
this.player = new tabageos.SimpleIsoCharacter(this._image,this.charLayer,null,552,570,0,32,32,32,null,32,32);
this. player._veloc.x = 4; this.player._veloc.y = 4;
this.player.moveLimits = [[13,11],[28,14]];
this.player.animation.animationSpecs = {
"north":[1,[6,7,8,9]],
"south":[2,[6,7,8,9]],
"east":[3,[1,2,3,4]],
"west":[2,[1,2,3,4]],
"northeast":[1,[10,11,12,13]],
"northwest":[1,[2,3,4,5]],
"southeast":[4,[6,7,8,9]],
"southwest":[3,[6,7,8,9]]
};
this.player.animation.onlyHorizontalAnimations = 1;
this.player.animation.currentAnimation = "north";
this.player.animation.animate();
//in this case xOffset is 545 and yOffset is 280, I arrived at those numbers by adjusting slowly and looking at how the scene looked between each adjustment.
//generally the xOffset param should be about half game width and yOffset is half xOffset.
//but these values can vary greatly depending on how your scene is going to be set up.
//the numbers to play with are xOffset and yOffset and game width and height, and scene._spread, scene._xSpreadShifter and scene._ySpreadShifter.
//a positive xOffset will show more of the left side of the scene.
//a positive yOffset will show more of the top side of the scene.
scene = new tabageos.SimpleIsoScene(32,32,this.display,this.charLayer, this.player, map1, this._image, [5,4], [13,11],[11,11],545,280, -.025,.01,0,this.camera);
this.player.scene = scene;
//this needs to be passed game width and height and the tile width and height.
this.camera.setIsoFollowOffsets(1100,1100,32,32);
//generally the following values should be between .0 and .9 positive or negative but generally not whole numbers.
scene._spread = -.0950;//spreads the whole scene out, each tile away from each other, negative to bring them all together more.
scene._xSpreadShifter = .10;//spreads each tile out along the x axis of the scene.
scene._ySpreadShifter = .010;//spreads each tile out along the y axis of the scene.
scene.render();
this.controller._basicControllerButtonTakedown();//default has only 2 arrows left and right.
this.controller.standardControllerButtonSetup();//four arrows. we very easily change the whole controller. The reason the takeDown methods are denoted private is because customControllerSetup uses them.
this.beforeStartGameLoop = function(e) {
//make player move left, to cause initial render of scene in loop.
this.controller.buttons.left = 1;
};
//to do it here would block the touch controller presses until left is pressed.
//this.controller.buttons.left = 1;
};
IsoGame.prototype.loop = function(ts) {
var movement = 0;
var cb = this.controller.buttons;
//this move method comes from SimpleIsoBox and returns true if actual movement happened.
movement = this.player.move(cb.left,cb.right,cb.up,cb.down,map1,32,32,this.player.moveLimits,1,0);
if(movement) this.player.animateInScene(1);
if(movement) {
this.charLayer.context.clearRect(this.camera.v.x,this.camera.v.y,500,500);
scene.render();//renders to offscreen charLayer.
}
this.cameraLayer.context.clearRect(0,0,500,500);
//camera is drawing from display then charLayer onto displayed cameraLayer.
this.camera.isoTweenedBlitLayerRender(32,32,scene,this.player, this.camera.cameraFollowOffsetX,this.camera.cameraFollowOffsetY, 0,0,60 / this._ts,"Linear",0,0);
};
new IsoGame();
})();
back to top