Cathode Tan - Games, Media and Geek Stuff
logo design by man bytes blog

Thursday, July 27, 2006

Canvas Collision Test

Having gotten some preliminary motion out of the canvas tag (that fancy HTML which helps build things like OS X widgets and the like), the next logical problem to solve would be collision. After all, games are mostly just objects ramming into each other. So, here's a really basic collision test which works like a busted version of Space Invaders. Ironically, it doesn't work on Safari - because of the fact that button events will pause Safari's canvad rendering. I was going to utilize a key event handler anyway, so that might be next.

Update: Key controls work now. A=Left, D=Right, Space=fire.

tagged: ,


GregT said...

Just played/tested it in Firefox. It seems to work okay but it's a little hard to tell because the shots don't seem to be displaying properly. They're either flickering too fast to see, or not drawing properly.

In any case, I seem to be able to shoot the green things most of the time.

Josh said...

Yeah, I'm not thrilled with the performance right now. The flickering might be "visual shearing" where the rendering isn't keeping up the frame rate. I'm noticing it on the red block as well, moving from left to right.

It's actually the very thing I'm trying to avoid. I knew, though, that using anything within a browser might be problematic since it's encapsulated within something else doing it's processing.

I'll continue to poke today, although sadly it's pretty bare bones already - so I'm not sure how much speed I can tweak out of it.