Legacy GM Need Help Hitting objects back to enemies

D

dawson2223

Guest
Hi Everyone,

Does anyone know of a good tutorial that demonstrates how to hit objects back to their enemies?
i.e. Ganondorf throwing an energy ball at Link, in which you hit it back to him, he hits it back, 5 times later he gets hit by his own energy ball.

Thanks!
 
greetings

start here


and then learn about how to track objects using point direction and distance , this should be a good start to get you on your way.

good luck
 

Yal

šŸ§ *penguin noises*
GMC Elder
If projectiles should only damage enemies after you knock them back, I'd change them to a different object (so enemies can't hurt themselves when they shoot). If the player creates a sword object when attacking, have the projectiles create the appropriate 'knockback' object when they collide with it, then destroy themselves. Could you explain the situation in a bit more detail? Topdown, platform, exactly how would you bounce things back, and in any direction or just a set direction?
 
D

dawson2223

Guest
If projectiles should only damage enemies after you knock them back, I'd change them to a different object (so enemies can't hurt themselves when they shoot). If the player creates a sword object when attacking, have the projectiles create the appropriate 'knockback' object when they collide with it, then destroy themselves. Could you explain the situation in a bit more detail? Topdown, platform, exactly how would you bounce things back, and in any direction or just a set direction?
Yeah I can explain more. It's a topdown. I have an attack animation where the sword is swung, so I was thinking of using a collision event of the attack object with the projectile. I am not so sure on how I would send the projectile back to him, and if I would be able to have 3-4 volleys going before I could actually damage the enemy with another collision event (this time being the projectile and enemy).
 
D

DevNorway

Guest
Make it so that if the ball hits the player, he gets damaged. But if it hits your sword, it'll make the speed of the sword negative. (speed = -speed;)
 
D

dawson2223

Guest
Make it so that if the ball hits the player, he gets damaged. But if it hits your sword, it'll make the speed of the sword negative. (speed = -speed;)
The speed of the sword negative or the speed of the ball negative? If I make the speed of the sword negative won't it just make him swing opposite?
 
making the speed of the ball negative, depending on how its laid out, might not make the object go in reverse, and if it does then your going to end up with the controls reverse while its moving like that.

also the ball in zelda that was being batted around with the bug net actively tracked the player, it didnt just bounce back and forth at random, i didnt get into that before because first you need to worry about hit boxes and making sure that you can switch the object to go after the other guy at a specific time before you start getting it to chase you.

this is actually not as easy as you might think to accomplish, between the hit boxes and the conditions and what happens if you hit a wall and how do you switch which player and/or enemy the ball is chasing after this can both get pretty crazy very fast and when fully finished it can in its own right be its own game if done well.

thats why i would just focus on the pong tutorial for now what you want is to create a collision box around your player while the animation is playing and to create a step counter for the other guy each time they are hit, the pong bar is basicly a fancy collision box and once you can reverse the ball when it hits once of those then you can worry about tracking and then how to actually injure one another, but making sure you can get the ball to move the way you want it to is the most important part, then you can worry about the effects.
 
D

dawson2223

Guest
making the speed of the ball negative, depending on how its laid out, might not make the object go in reverse, and if it does then your going to end up with the controls reverse while its moving like that.

also the ball in zelda that was being batted around with the bug net actively tracked the player, it didnt just bounce back and forth at random, i didnt get into that before because first you need to worry about hit boxes and making sure that you can switch the object to go after the other guy at a specific time before you start getting it to chase you.

this is actually not as easy as you might think to accomplish, between the hit boxes and the conditions and what happens if you hit a wall and how do you switch which player and/or enemy the ball is chasing after this can both get pretty crazy very fast and when fully finished it can in its own right be its own game if done well.

thats why i would just focus on the pong tutorial for now what you want is to create a collision box around your player while the animation is playing and to create a step counter for the other guy each time they are hit, the pong bar is basicly a fancy collision box and once you can reverse the ball when it hits once of those then you can worry about tracking and then how to actually injure one another, but making sure you can get the ball to move the way you want it to is the most important part, then you can worry about the effects.
That helps a lot. Thank you!
 
Top