0 votes

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!

in Engine by (12 points)

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!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.