Created
February 28, 2013 22:55
-
-
Save unstoppablecarl/5060862 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add tile | |
ig.game.addItem({ | |
_layer : 'bg', | |
update: function(){ | |
var mainMap = ig.game.getMapByName('main'), | |
tileSize = mainMain.tilesize, | |
ctx = ig.game.bgCanvasContext, | |
x = tileSize * x * ig.system.scale, | |
y = tileSize * y * ig.system.scale; | |
ctx.save(); | |
ctx.fillStyle = 'tan'; | |
ctx.fillRect(x,y,tileSize,tileSize); | |
ctx.restore(); | |
}, | |
draw:function(){ | |
// empty the array we dont want to draw anything with these objects | |
ig.game.layers[this._layer] = []; | |
} | |
}); | |
// remove tile | |
ig.game.addItem({ | |
_layer : 'bg', | |
update: function(){ | |
var mainMap = ig.game.getMapByName('main'), | |
tileSize = mainMain.tilesize, | |
ctx = ig.game.bgCanvasContext, | |
x = tileSize * x * ig.system.scale, | |
y = tileSize * y * ig.system.scale; | |
ctx.save(); | |
ctx.clearRect(x,y,tileSize,tileSize); | |
ctx.restore(); | |
}, | |
draw:function(){ | |
// empty the array we dont want to draw anything with these objects | |
ig.game.layers[this._layer] = []; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment