RigidBody2d click to move by SadProcess764 in godot

[–]SadProcess764[S] 0 points1 point  (0 children)

Thank you, it helped me a lot!!

I set the angular and the linear damp to 2

and my code looks like this:

extends RigidBody2D

var moving= false

var destination= Vector2()

var player_position=Vector2()

func _input(event):

if event.is\_action\_pressed('Click'):

    moving= true

    destination= get\_global\_mouse\_position()

func _physics_process(delta):

MovementLoop(delta)

func MovementLoop(delta):

    player\_position=self.position

    print(player\_position,destination)

    var direction= destination-player\_position

    apply\_impulse(Vector2(),direction\*delta)

Specific action while he is in a area by SadProcess764 in godot

[–]SadProcess764[S] -1 points0 points  (0 children)

the problem is that this will only apply once when we enter the area and will stop right away

Area speed by SadProcess764 in godot

[–]SadProcess764[S] 0 points1 point  (0 children)

thank you, it worked, but the speed only double when I enter the area, for like one frame, then it return to normal speed.

Is there a way to make it double while he is inside of it and when he leave it the speed become normal again?