How to make a player mouse jumping system in Godot v4?

Godot Version

Godot v4.5.1 stable

Question

I want to make a sort of mouse jumping system, like the games: GunPoint or RONIN, or golf games. Where you move the arc to make the avatar jump to there, for my 2D platformer game.

I want the gameplay to be like RONIN, where you can grapple to a nearby wall, after jumping.

Thank you!

Referencing games we’ve never played isn’t going to help us help you. Describe how exactly you want it to work.

1 Like

I have searched around, and found tutorials. But what I want is to be able to make the player jump to where the mouse aims at.

The referenced games are just to get the idea of what I want. Like the Angry-Birds-Clone by fine point cgi.

I decided to use a Rigidbody2D, instead of the characterbody2D, but I don’t know how to make the mechanic.

You can get a vector to the mouse position using direction to on the noises position. You will normalize that vector and add a force in that direction

Pseudo code:

Linear_velocity += position.direction_to(mouse_position).normalized * strength

How would you make the slingshot system? And, when the player is in mid-air, you could grapple to a nearby wall?

Thank you!

Pick one of them and follow it.

Theoretically that could work for a slingshot system, I don’t know exactly what the need to give better help unfortunately.

The grappling, if you have a system I’d choosing the wall then you could teleport to the wall and potentially have an enum for slingshot movement and on the wall to contain different logics. A state machine would be better but that is beyond my knowledge. If the grapple is mouse based or something you could have a raycast and get the intersection point.

Edit

More pseudo code for this stuff

enum states = {slingshot, flying, grappled}
var current_state := states.slingshot

func process():
    match current_state:
        states.slingshot:
            launch()
        states.flying:
            grapple()
        states.grappled:
             pass # whatever would happen here
func slingshot():
    if leftmousepressed:
        #launch code I sent earlier 
func grapple():
    if leftmousepressed:
         position = raycast collision point

Forgive me for this was written on a phone without the ability to do much research on the methods for certain things

1 Like

Thank you all very much for your help!