|Topic was automatically imported from the old Question2Answer platform.
Pull back an release mechanic
Hi! I’m wanting to make a 2d golf-like game with a pullback for different powers. Does anyone have any source code for a mechanic like this or a video? I can’t find anything. Thank you!
I’m making a game with a similar mechanic to this. The way I do it is assign an input action to the pullback, and in the process function, I have a potential velocity (int) variable goes up (multiplied by delta). When you release, it adds this potential velocity to the velocity variable (assuming you have one in your player already. The way you can have directional inputs with this system (mouse control example) is to add
get_local_mouse_position.normalized() * potential_velocity to velocity.
This is just a rough idea of what you might want, but I hope this helps!
Nathcra | 2022-01-24 04:14