• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Need help on blocking

T

Triglaw

Guest
Hi everyone,
I'm currently working on rpg game where your character moves in 8 directions and he is facing and attacking based on the position of your mouse form the character. I also want to make the character block, but I cant make the code to block properly.
Here is how I want the block to work. When I activate block, the character can block 80% of the damage from his front side. Character's front side is from the center of the character to the mouse position at constant distance and 45° angle at both sides. I already have the sprite animation, block key/animation and the direction, but I cant make the code to reduce the damage by 80% if I block the damage and take full damage if I'm not blocking or the damage is coming form another direction.
Thank you in advance.
 
C

chico_haze

Guest
An easy solution might be to enable an actual shield object at the angle you want the shield to be facing. If that object gets hit, it destroys the incoming missile but transfers 20% of the damage to the player object.
 
Top