Oh man, I don't have any pictures to accomodate this entry but while working on my in-between game I had accidentally figured out a great way to have melee collisions vs. enemies where each enemy would only get hit once by the weapon but where you could possibly hit 2 (or more) said enemies during that same swing.
What I had been doing in H2 since 2007-ish was using a flag whenever Rovert hit an enemy and after the swing was done the flag was reset to "off". This worked all fine and dandy except when bunches of enemies would try to get you all at once. In that event you'd damage one of them, sure, but the others that would be getting struck with your weapon would go uninjured (and probably laughing at Rovert on the inside to boot.) I then tried taking out this flag and have some "if the WOOSH sound isn't playing" and other checks n' balances but what'd then happen with the slower swinging 2-handers is you'd hit multiple times on the enemy on that same swing. And for what I was trying to do, that sucked!
Flash forward to last week: I was screwing around the MMF2 event editor and saw something I've never used before, which was an object's Fixed Value. As I've recently learned this is the overall object ID on any given frame and can't be changed. Then it hit me on not only how to make a decent hit system on the new one, but how I could also use this new method on H2 and fix it.
Extremely basic (and forgive me if all of you already know how to do this, which I don't doubt) princible:
*Your hero has an alt value, which for now I'm calling "WHO HIT".
*Whenever your melee weapon makes contact with any enemy, a condition of damage is "If alt value WHO HIT <> Fixed Value(Enemy)". If damage is scored, the player's WHO HIT value is then updated with the target enemy's fixed value (which keeps it getting hit just that once per swing).
*Lastly down at the bottom there's a simple check saying "If player weapon isn't overlapping any enemies, set WHO HIT to 0". This resets the weapons so you can hit more things again.
--
The great thing about this is now you can hit an enemy once per swing, but if there's another enemy right behind it the weapon will strike (updating WHO HIT to that first one's fixed value) and then hit the second enemy exactly one time only while it's following through because the value for WHO HIT is now different. This is incredibly useful for this game's axe weapon where now you can hit monsters on either side of you with a single swing.
Anyhow, this new way has been added to every monster in Hasslevania 2, and it really only took me a solid 2 days or so to make all the appropriate changes and deletions to the code. It might be easy and simple to most but it was one hell of a "Eureka!" moment for me.
Thank you and Good Night.
|