Pages

Saturday, August 25, 2012

11: 3-Hit Barrage

This time we actually give Tanner access to his full three hit combo, and let him swing to the left finally.

Explaining this part is going to be a little difficult, as my approach was much different than most other moments. See, the next two steps are fairly simple in theory, but I ran into problems every step of the way.

The easier issue to deal with is Tanner's inability to strike anything to his left. After duplicating and flipping Tanner's combo graphic to face the left, all you really have to do is add a bunch of OR statements to any if statement involving the attack graphic.

The more difficult issue is letting him perform swing 2 and 3. Just like with the directional issue, I had to add a bunch of OR statements for the 9th and 19th frame. The next step is a little more complicated, sorta.

Every time the player presses Z to reactivate the attack, the frame is reset to 0. We need an exception. There's a few we could use, but I just ended up with this:

Step Event:
if ((sprite_index == spr_tswingr) || (sprite_index == spr_tswingl))
{
     image_index += 1
}
else
{
     image_index = 0
}

And... that's about it. Every single part of this post was a mess of trial and error. I added some code, tested to see if it worked, and if it didn't, I fixed the typo or adjusted the logic. For the most part, you should definitely check out the .gml file and read the code.

A couple of pieces of advice I learned from this however:

   Be very careful with your parenthesis, especially when it comes to ANDs and ORs.

   Be careful mixing "!=" (NOT) with ANDs and ORs. The logic becomes fairly difficult to follow, and usually your code won't work.

Here's the .gml file:
     https://www.dropbox.com/s/4n0ewv0lyvfj9ni/11%203-Hit%20Barrage.gm81
Here's the .exe file:
     https://www.dropbox.com/s/ly8i6mo3vxjpi1l/11%203-Hit%20Barrage.exe

1 comment:

  1. Y U NO MAKE NEW POSTS?! C'mon man, it's been three freaking months! Get it together!

    ReplyDelete