Archives - February 2010
2010.02.27
A good piece of the engine that needed some revisiting, tweaking, and overall love was the object carrying code. The basic structure for being able to hold and carry certain objects has been in place for a while, but it never functioned exactly how I wanted. To say the least, it definitely didn't look very good. The player picks up and object and magically it's floating in your hands. By "in" I mean "off to the side". What was missing was a way to track objects into the players hands. In addition to that, the player was still missing an animation for holding an object. Not any more!

The player now has special animations for holding an object. This includes the nice bit of polish that will draw the player's outer hand on top of the object they are holding, to greater push the illusion. On top of that, I also added in a little animation when picking up an object as well. So now, instead of magically floating into your hands, the player will bend over to pick up and object.




The system is pretty straightforward. There are points on for the player's "hand" position, as well as special points identified on objects that can be carried which dictate where their "grapple" position is. Once you get these points all you need to is a little offestting to make sure they show up in the right spot. The best part about all of this is that I didn't have to implement too much new code. Sprites already had the capability to contain an arbitrary amount of bounding box data for each frame of their animation. Simply add a few new bounding boxes for grapple points and most of the work is done. I'm glad I implemented this capability way back in the engine's beginnings. I was wondering if I would ever use it!

There are still a few things to tweak, though. For instance, picking up a really huge object can look a bit awkward!



2010.02.23
Trigger objects are complete. As expected, they didn't take long to implement since they are quite straightforward. The first is the toggle switch which, when flipped, will toggle the state of a toggleable object. Here I have a test switch hooked up to a test door. Flip the switch and the door opens. Flip it again, and the door will close.




Another little nicety that I had been planning on doing for a while was a splash animation on entry into a water area. I've added this in, with sound, and it looks okay. The actual animated sprite will need a bit of work but it gets the job done. Any arbitrary amount of "splashes" can be added to a water area. For now, they are only created when the player enters and exits a water area. So far they are vertically oriented as objects should only enter or exit a water area from the "top". I may revisit this in the future if it is necessary.




I mentioned that the splash makes a sound on entry and exit of a water area. In testing this I exposed a little bug in my wrapper library regarding sounds. I initially thought I'd have to rewrite most of the sound handling code, but it turns out I was naively doing the wrong thing when it came to stopping currently playing sounds. One line later and everything works fine! I love those kinds of fixes.

2010.02.13
Time has been a little limited lately. I spent some efforts to graphically revamp the powerups in the game. The old placeholder graphics no longer matched the style that the rest of the game was going in, so they really needed an overhaul. The powerup icons animate in the following ways: glittering/shining to draw your attention, fading away once acquired, and floating up and down.




Other than that, I've been spending some much needed time with the game's code. The engine was still lacking a way to have objects become altered due to certain conditions in the game. The plan is to extend the "conditionality" even further and implement object triggering. That is, instead of simply checking for prefab conditions I can have an object like a switch open a door when it is triggered.

The mechanism for this is pretty straightforward. Certain objects in the game world are considered "toggleable"; they can be changed between an "on/off" state. These toggleable objects can be given a simple string identifier. In addition to this, we have the "condition checker" objects. These objects can reference the label of any toggleable object. The checker objects enforce a set of rules, and once met (or switched from being met to not being met), these objects will find the toggleable object with a given label and toggle it. There's not much to it. Trigger objects will be much the same except they will require direct interaction from the player or NPCs in order to toggle a toggleable object. The plan is to implement trigger objects next.
copyright © 2001 - 2010 loomsoft