So I'm trying to repeat a portion of my spritesheet as a background. So far, I have attempted this:
var canvas = $("#board")[0],
ctx = canvas.getContext("2d"),
sprite = new Image();
sprite.src = "spritesheet.png";
sprite.onload = function(){
ctx.fillStyle = ctx.createPattern(spriteBg, "repeat");
ctx.fillRect(0, 25, 500, 500);
}
As you can see, it repeat the whole image, not just a part of it, and I just can't figure out how to do that last part.