How would I program a puppet to block an attack?
I'm making puppets for a possible multiplayer fighting game. I have attacks wired to keyframes and health modifiers that work just fine. I even have the block keyframe working fine, but I can't seem to figure out how to wire the logic of a block attack.
For instance, how would I tell the opposing puppet that when it enters the block zone and attempts to attack, but the other puppet blocks, that causes its attack to do little or no damage?
I've tried searching for a few creations in case anyone figured this out already, however I have come up short in results. I would really appreciate the help.
Thank you!
-
So that's not all that easy, but here's how you could get started:
- Use wireless transmitters (WT) to broadcast your attack. You'll have to tune your attack animation so you'll send the WT signal at the correct time and for the length you see fit, but other than that, you just have to put in a descriptive label and put a wireless receiver on the blocking enemy.
- Set the label on the receiver to match your attack label. Whenever you attack, the enemy's wireless receiver should now pulse during the damaging part of it.
- Now is where you check whether you block. Since we only really want a signal (for this part of the damage logic, at least) when you both broadcast the attack (because of your attack) and have a blocking enemy at the same time, you'll need an AND gate for both wires.
- You can, of course, wire it all traditionally. The major difference between WT/WR and hardwiring it is that you don't have to bother with scoping at the right level and having to trace wires - as long as you keep track of what broadcasts which signal to whom. Say you make an emitter-based system that keeps spawning baddies for you to kill: if you forget to use enemy-specific trigger zones for your default damaging attack, you might accidentally run your damage logic in all the enemies reacting to your puppet's wireless transmitter - despite you only attacking one of them. So keep an eye out for that.
To summarize this fairly complex topic:
- during your attack animation, fire a signal. Take this signal and put it in an AND-gate with the blocking logic. Whenever both criteria are satisfied, you'll run the low/no-damage logic. Copy the logic, take the same input and put a NOT-gate between the blocking logic and damage logic #2. This is your normal hit and will branch into full-damage logic.
If you're having troubles with any of this, like how to generate a signal during the animation, I'll be happy to look at your project. Just post it here and I'll get the basic setup running for you. Depending on your game, there are tons of different and possibly more suitable approaches. -
Thank you for your help! I'll try this out next time I jump back into my project.
-
Hey, I know its been forever since you asked this - but - you could make all your attacks (health modifiers) only affect enemies.
then when your enemy is blocking, just turn on a keyframe that makes them no longer an 'enemy'
-- same in reverse, your player is tagged as a 'friend', your enemies damage modifiers only affect 'friend's so when you block, turn off that tag. Maybe switch it to 'scenery' or something if you need to be tagged for collision purposes.
Iniciar sesión para dejar un comentario.