Setting fill and Stroke style can have a negative performance impact even if you dont use them and are setting them to what they used to be. (Firefox)
ctx.fillStyle
ctx.strokeStyle
Also I can't make dirty rectangles code run as fast as just doing a big clearRect for the whole canvas. This is for frantic - a space invaders style game where nearly every sprite will have moved since the last paint
ctx.clearRect(0,0,width,height);
Drawing text on canvas:
fillText about twice as fast as strokeText
Showing posts with label game. Show all posts
Showing posts with label game. Show all posts
Tuesday, 7 December 2010
Sunday, 21 November 2010
JS Game programming main loop
Use this piece of JS to repeatedly call update() method every 10ms.
Handy for game loops!
setInterval(update, 10);
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Full breakout game guide with keypress, mouse & animation
Handy for game loops!
setInterval(update, 10);
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Full breakout game guide with keypress, mouse & animation
Thursday, 18 November 2010
HTML5 game
My first html5 game:
http://nuclearcarrot.com/html5/mouse/
Code:
https://github.com/bootandy/google-bouncing-balls
Notes:
HTML 5 cheatsheet
http://nuclearcarrot.com/html5/mouse/
Code:
https://github.com/bootandy/google-bouncing-balls
Notes:
HTML 5 cheatsheet
Subscribe to:
Posts (Atom)