topical media & game development

talk show tell print

mobile-game-ch08-spriter-basic-spriter.js / js



  var fs = require('fs'),
      Canvas = require('canvas'),
      canvas = new Canvas(200,200), 
      ctx = canvas.getContext('2d');
  
  ctx.fillStyle = "#CCC";
  ctx.fillRect(0,0,100,100);
  ctx.fillStyle = "#C00";
  ctx.fillRect(50,50,100,100);
  fs.writeFileSync("mobile-game-ch08-spriter-sprites.png",canvas.toBuffer());
  
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.