Skip to content

Instantly share code, notes, and snippets.

@tlhunter
Created September 17, 2012 23:03
Show Gist options
  • Save tlhunter/3740310 to your computer and use it in GitHub Desktop.
Save tlhunter/3740310 to your computer and use it in GitHub Desktop.
Cobalt Calibur Tile Drawing
drawTile: function(x, y, tile) {
var x_pixel = x * app.graphics.TILE_WIDTH_PIXEL;
var y_pixel = y * app.graphics.TILE_HEIGHT_PIXEL;
if (tile == null || isNaN(tile[0])) {
return;
}
app.graphics.handle.drawImage(
app.graphics.tilesets.terrain,
0,
tile[0] * app.graphics.TILE_HEIGHT_PIXEL,
app.graphics.TILE_WIDTH_PIXEL,
app.graphics.TILE_HEIGHT_PIXEL,
x_pixel,
y_pixel,
app.graphics.TILE_WIDTH_PIXEL,
app.graphics.TILE_HEIGHT_PIXEL
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment