Monday, September 12, 2011

MoreWithTheBugHunting


(Another long-ish post about code.  FYI).


In the beta, there's a bug where if you die & restart while being double teamed, both monsters will become invisible.  I believe I have that fixed.  I thought I was pretty clever & used the state variable (in my case, _root.held) to track how you die as well.  That variable used to only tell if you were held or not, but it has since grown to pretty much capture any state - moving, attacking, grappled, etc.  So having it also track death & death type wasn't really a stretch.  So now when you hit continue, the game knows if there were any grapplers & what to do with them.  But this change brought along new 'interesting' bug.  Being killed by a grapple caused the 'game over' screen to play twice. 

Now, this is not a game breaking bug, so I put it on the back burner as a 'huh, wierd' issue to be resolved later.  I was the mood to do some puzzle solving last weekend, so I picked this one up as a challenge. 

Those of you who are thinking that having one variable track so much is a mistake are on the right track.  Turns out that late in the 'death' code this variable was getting reset as part of a pose change, which was causing the whole thing to reload.  So I reckon the lesson here is watch what your variables are doing.  I'da never found it if I hadn't been tracking the held variable & just watched the hero get killed over & over.  Which made for an interesting night BTW.  ;P

The other bug I found this week was even more subtle, but it's been in the game for a while & man has it irked me.  If you managed to completely shift the grapple in your favor, the whole bar is supposed to shift to your color & the arrow game is supposed to end.  However, half the time the arrow game would continue after the bar changed color.  Now, this was a frustrating bug to track, because honestly I don't peg the grapple meter all that often.  So I'd see the bug, look for it for a few minutes, get distracted, and then not notice it again for a week.

The problem all stems from how I named these variables.  In this case I was looking for a variable called grapplebararrowcheck, which gets set to false if the the bar gets maxed.  The problem ended up being I mistyped the variable in some places as grapplebarrowcheck.  See the difference?  Yeah, I didn't either.  What if I type it as GrappleBarArrowCheck and GrappleBArrowCheck?  More obvious now? 

Up til now I had been purposely using all lowercase letters in my variable names, to avoid any problems with case.  Now that I've made this mistake though, I think I'm going to move to capitalizing the first letter in each word.  Flash already does something very similar with it's commands - it capitalizes every word past the first.  I'm told this is known as camel case.  Yet another smart idea I wish I'da picked up on sooner.  Ah well, now I'm all learned & ready for the next bug.

And believe me, there's going to be more bugs in the next release.  So far I'm only talking about the ones I've actually fixed.  There's a bizarre one at the moment where trying to save the bunnygirl will occasionally spit everyone out into the engine room & lock the game.  I still haven't puzzled out exactly what triggers it, so I'll have 'fun' hunting that one.  Maybe I'll draw some more first.  hahaha

DirtyC101

3 comments:

  1. Hey Dirtyc101, sry i ask here but where the autosex scences by "attack of the summer art"?
    sry for my very bad english.
    btw nice work!

    ReplyDelete
  2. Dr34, Been getting that exact question a lot this week. Did the game get reposted somewhere? Regardless, I went ahead & updated the original posting on Newgrounds to show how to unlock both methods. Link is in the sidebar, then look at the bottom of the cheat codes.
    DirtyC101

    ReplyDelete