I am working on a game like Super Smash Bros. and i would like my character to directly strike an enemy instead of shooting objects but I don’t know how to do it. Could I get help please?
This is actually not possible, and this is exactly what I needed for my game. I made a suggestion for grazer but he didn’t respond yet:
It should actually be possible with the RayCast behavior which emits an invisible ray. The problem is that you can’t really do something with the object that got hit by the ray.
i would like my character to directly strike an enemy instead of shooting objects but I don't know how to do itDo you mean strike with a sword or something similar in close proximity?
Wasn’t that already clear in my and his post? Do swords shoot? I think they don’t.
Instead of shooting an object with the emit behavior. He wants to shoot something that directly hits its target. Increasing the velocity to a high value isn’t a good idea because it’ll be able to go through objects.
I don’t see why he needs to shoot anything or even use raycast, could emit/spawn an attack block on whichever left/right he last moved and do either a collision or minimum proximity check to output a hit. Or you could just calculate the X distance away from either character using proximity to output hits. I think collision might be the best for this depending on how his objects are shaped since proximity checking begins at the center and checks the center of objects whereas collision happens at their borders, it is a little more accurate.
edit: Quick demo using spawning and collision http://flowlab.io/game/view/861190
I think @Wizardry has the right idea here - this is actually a pretty typical approach.
I have two examples on the examples page: http://flowlab.io/examples
@grazer What if we want to make a gun for example that immediately hits its target when shooting.