Today is collision detection day. Mmmm…my favourite. I use the term ‘day’ loosely, as it’s actually 10pm. I have to go to work you see, and this takes up all my day when I could be doing….anyway, I digress.
Suddenly, I have a remarkable brain wave – why not create a second bitmap of the maze made of simple white solid blocks, then just use the POINT command to check for collisions! I later discover that this amazing technique has been used in platform games for years and I’m humbled again. Anyway, how will DarkBasic cope with it? Not very well as it turns out. The POINT command seems to be extremely slow. At first I thinks it’s just because I’m switching bitmaps to do the check – but no, it’s just as slow when checking the same bitmap. This is BAD NEWS. I make a mental note to post a query on the forums. I have to think up an alternative before I go to bed or I’ll never sleep.
I spend an hour creating DATA statements for the maze to read into an array which I’ll can use for collision checking instead. This is considerably faster. Success at last! Pac-Man is now plodding around my maze without going off in any illegal directions. It’s only when I’m nodding off that I realize I could have just read the bitmap to create the array data rather than typing it all in. Oh well, live and learn.