Shooting Mechanism

Godot Version

Question

for my game, because it is not a eagle eye, the shooting animation would have been hell to animate so I had to think of something and i realised i could stop the player from moving when he wants to aim and shoot (like the original RE4) but i have no idea how to code the animation part.
Screenshot 2024-06-21 173415
8 ways and i dont know how to call them in the code… should I use PI? how should i use it? and i should make a new animation tree for it? or animatedSprite would be enough?

You can use the player’s velocity / input vector and a series of if statements to check what direction the player is moving in and then play the corresponding animation. Using AnimationTree, you can skip all that code and pass the input vector into a BlendSpace2D and it will automatically choose the correct animation for you. I don’t think you need PI, though

yeah but i would need the code for the mouse Crouser… for the aiming part and the character would need to face the way that the Crouser is

You can use get_local_mouse_position() and then normalize it to get direction the character should face

and how would I use the animation tree for it? I am so sorry im new to coding and newer to Godot

AnimationTree is pretty complicated so I recommend looking up a tutorial for it.

You need an AnimationPlayer with an animation for each angle of every animation. Then you will need to make a state machine in an AnimationTree, and then make blendspace2ds in that state machine. You will need to put in all the animations into the blend spaces and then via code pass in the input vector to all blendspaces

1 Like

in other words it would be another hell to go through

:cry: games are a lot of work

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.