[insert blogger navbar here]

Random Ramblings

Sunday, 15 November, 2009

RR (16,10): Vapourware condensate

I've actually started programming some things I left alone last year, or even longer ago. I'm not quite sure why. Here's a sample. (The Snake-Tron-clone-thing I mentioned in an earlier post.)

Of course, since for now nothing else has materialised (especially also considering I'm programming something for someone), I'll just include a screenshot of it here.

[screenshot]

I'll list some important things when porting this from TI-BASIC to JavaScript. The most obvious is that keyboard handling is different. In TI-BASIC key handling is done through a queue, in JS key handling is done through events. In other words, in TI-BASIC you have to check for yourself whether or not a key has been pressed, while in JS you set up a program/function that is called every time a key is pressed. And because of certain gameplay requirements, using a queue is far nicer, so I had to implement a simplified queue. It's a pretty dumb idea, but it works, somewhat. The amazing downside is that it lags quite a bit, being just somewhat slower than the GC.

The other thing is that the Canvas API is actually high-level, as compared to the low-level drawing API in TI-BASIC. This makes direct checking of collision without additional storage impossible. In TI-BASIC is just checking whether there are pixels there already; in JS I had to use another variable to keep track.

I think I'll stop here and be more productive for a while. The other mode of Snake (the other weird one I mentioned in the earlier post) might get implemented as well; it's a pretty interesting concept, and it'd be nice to play without immense lag.

0 Comments:

Post a Comment

<< Home