Sunday, February 12, 2012

Underway

I have to keep this fairly short because...

I've started my programming course now.  Four nights a week with a couple hours between work and study, which i am now using to post here.

So far it's been pretty simple stuff, introductions to how the place (Computer Power) runs and does it's assessments.  My current module is a guide to using Windows 7...  It's got 20 hours assigned to it, hopefully i can get it out of the way tonight.

In a strange bit of irony, my last session of last week was cancelled, luckily before i got on the train, because the computers at CPI weren't working.  Hehe.

As to the programming of my FF game.  Well, it's been held up a little due to a lot of spare time being unavailable and spending a couple of weekends actually relaxing and doing nothing.

I finished writing the gosub for fighting three enemies and it mostly seems to work.  Unfortunately it doesn't completely work as it's intended to.  The sub basically consists of three parts.  In the first you have three oppoents and can choose to fight either of them and change opponents after each attack if you want.  When one dies the sub advances to one of three different continuations which deals with only the two enemies left.  When you finish off one of them the sub goes to one of three final stages, one for each enemy which could have survived till the end.

The sub works perfectly up to this point, switching between each section as each enemy dies but when you finish off the last one, it doesn't return as it should.  Instead it goes back to an earlier stage, usually the middle point where two enemies remain and repeats from there.  Of course the enemies are dead but they have just been promoted to undead thanks to this glitch.  They have negative hit points but can still attack...

I have thought of a posible solution though.

Currently the sub is, as it sounds, one long gosub with different [sections] for the process to flow through, or past then return at the end.

I'm thinking of breaking it up into seperate gosubs, each dealing with one stage of the fight and each returning to the original [area] after one enemy is finished off.  Then there will be code in the [area] which checks to see who died and directs the process to the next appropriate gosub part.  That will mean a bunch of extra code in each [area] that contains enemies.

I can work around that though.  I can make the section which sends the process to each relevant gosub a gosub itself so the process should go like this:

arrive at [areaX] with enemies.
gosub [fight] and check number of enemies
if enemies = 3 then gosub [fight3]
etc.
when one enemie dies, record as dead then return to [fight]
check which is dead then gosub [fight remaining two]
record which enemy dies then return to [fight]
check which died again then gosub [fight last]
return to [fight] when last is dead
run through a post fight sequence then return to [areaX]

Apologies if my notations don't look anything like they should, i'm still winging it afterall.

Hopefully that will work.  If it doesn't i think i'll really be at a loose end and have to go back to the max of two enemies...