Re:Show HN: HTML5 Ping-Pong Game
by sopooneo on Tuesday July 10, 2012 @10:01AM
(#4223789)
That is cool. I love the touch of the little dust explosions off the paddles. For anyone else that wants to start playing with canvas, let me relate a gotcha that drove me absolutely nuts. And if I'm mistaken on this, someone please set me straight.
The issue: You can not paint pixels directly onto a canvas. Instead you create a buffer of specified dimensions, indicate what colors to make its pixels, then overlay that buffer onto the canvas at a specified location. So it is possible to wrap that functionality up into an api that lets you simulate direct pixel painting, but it is not possible with raw javascript. Lines and other shapes, on the other hand, can be rasterized directly onto the canvas.
Re:Show HN: HTML5 Ping-Pong Game
by freehunter on Tuesday July 10, 2012 @12:38PM
(#4224662)
Are there any good tools/frameworks for HTML5 games yet? Every time I see a rundown of how a developer made an HTML5/JS game, the common complaint from that dev is that the tools are far from mature and they had to recreate X and Y by hand.
Re:Show HN: HTML5 Ping-Pong Game
by davidstith on Tuesday July 10, 2012 @02:38PM
(#4225379)
Nice job! I was looking for something like this for a project I'm working on. Just FYI - If I resize the window to the width of the paddles I can play forever :) http://imgur.com/ukxi8
The issue: You can not paint pixels directly onto a canvas. Instead you create a buffer of specified dimensions, indicate what colors to make its pixels, then overlay that buffer onto the canvas at a specified location. So it is possible to wrap that functionality up into an api that lets you simulate direct pixel painting, but it is not possible with raw javascript. Lines and other shapes, on the other hand, can be rasterized directly onto the canvas.