Tuesday, November 22, 2011

Development Log: January Engine - Week 4


It took me a while to get back in the groove of programming the January Engine, but it's coming along now.  Unfortunately the holidays may cause sporadic updates on it.

I've added NPCs, which you can talk to by clicking on them.  Originally I had it so you walked up to them and bumped into them to talk, but I thought that was kind of silly.

"And he clicked the purple N, and the N talked, and he saw that it was good."
There are also health pools now (blue squares with "H" in them), which restore you to full health.  This is useful because now after finishing a battle your health stays the way it was when the battle ended, instead of automatically regenerating.

You can also die now.

I added some colors just so the screen isn't purely black-on-white, although when I start adding "real" placeholder art it will all change.  But in the meantime, the colors allow you to know what you're doing at a glance.  For instance, you quickly memorize the color scheme for the battle cards, so you spot a "Damage 3" card just by color without having to read it.

I also learned how to embed images, although I won't be adding any art until I actually learn to make something decent.  I tried making a simple dirt square a couple of times with bad to worse results.  A friend sent me a link to a Gamasutra article on 2D art for programmers, and currently I have yet to make any art remotely on par with the article writer's.  Basically, I'll add art when it looks better than the textfields.

I also restructured the code so the Overworld section is not in Main; it's its own class like the Battle Class, so pretty much the only things in main are the ENTER_FRAME check that determines if a battle should occur (and wipe out the Overworld) and bring back the Overworld when the battle is over.

I don't like ENTER_FRAME checks, because I feel like there is a better way to accomplish something.  ENTER_FRAME always seems to me like a waste of memory.  Instead of the event listener, I think there should be an event shouter, if that makes any sense.  Unfortunately, there is little in the way of making that work, so I just try to remove the ENTER_FRAME check whenever possible.

I also added an inventory button, which doesn't work, so don't bother.  I think I'll be making that functional for next week's log.  The inventory will allow you to look through your deck and see what cards you have.  Eventually I intend to make the deck customizable, so you can swap cards in and out to get a deck to your liking.  But that'll probably be much later.

So next week I think I'll be trying for that inventory functionality, as well as making the enemies move around.  I might also have art, if I'm not too frustrated by it.  I figured I could always make intentionally bad art, but it's tough to even get up to bad quality.

2 comments:

  1. Out of my own curiosity, I did a little digging. For efficiency sake it seems the best bet is the "setInterval" function explained here: http://www.republicofcode.com/tutorials/flash/setinterval/

    Basically allows you to control how often a function is called in milliseconds. Theoretically you could set it up to turn on/off repeating functions when they aren't needed, like if the player is idle, etc.

    ReplyDelete
  2. Alternately, you can make custom events, just not 100% sure how.

    ReplyDelete