Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Forked from anonymous/gist:1540718
Created December 30, 2011 17:37
Show Gist options
  • Save hughfdjackson/1540723 to your computer and use it in GitHub Desktop.
Save hughfdjackson/1540723 to your computer and use it in GitHub Desktop.
codazoda - pastebin.com/iSQYG4DY
// Create the Iso class
function Iso() {
// Public Properties
this.canvas = '';
this.context = '';
}
Iso.prototype.init = function(div) {
this.canvas = document.getElementById(div);
this.context = this.canvas.getContext('2d');
}
Iso.prototype.draw = function (x, y, z, file) {
// Load the image tile
var imageTile = new Image();
imageTile.src = file;
// Calculate the position
var calcX = x;
var calcY = y;
// Draw the image tile
this.context.drawImage(imageTile, calcX, calcY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment