Spooky Pooky #48 - We Get a Gun

Published on 01 Apr 2016 by Joe

So then. Weapons. Here we go, some explodey bang-bangs. Finally poor Horatio can fight back ...

(The gif encoding has washed out some of the colours so it's all looking a bit grey at the top there instead of the vile green/yellow it should be..)

So here he has a simple laser gun with which he is massacring some defenceless, and harmless, caterpillars. Well, he has been through a lot, so we'll cut him a little slack.

As usual this all took a lot longer to get working than it probably should have, thanks to my usual approach of implementing just enough but no more. My code-that-is-where-an-engine-would-go .. um .. engine .. carried out collision checks between the player and other (suitably flagged) entities, but not between arbitrary entities such as, say, a laser bolt and a caterpillar.

So first change was to pull out this collision stuff into a more generic form, which was reasonably simple. My entities implement flags (such as E_COLLIDES_ENTITY) indicating that they'd like to collide with other things. If they do they can then indicate that they'd like to receive events (i.e. notifications) that they hit something by adding an event to their event mask (e.g. EVT_COLLIDE). This way I only collide things that care together.

The generic code will also apply damage (if the collider has a 'damage' quantity set) and trigger a corresponding EVT_HURT (or EVT_DEAD if things get really bad) in the collidee. That's a word, right?

So things are coming together in the main system to support this stuff. Along the way I've noticed several glitches (such as caterpillars falling through the floor when they crawl into a door), so I'm accumulating a little list of things to fix which I pick off when I've got a spare 10 minutes to kill.

I've also been a good boy and tried to keep adding sound effects as I go. The game has a sound design best described as 'glitchy' and 'atmospheric', to suit it's techno style.

The weapon implemented (laser) is just a test, and really belongs to various enemies, although I may add it as a collectable weapon. So next up is to design and implement the various weapons I really want Horatio to wield, plus their effects on the enemies and environment.

Published on 01 Apr 2016 by Joe
Back to index