Yes, But i am using ball as my character

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kushal Pangeni

But, it’s a ball and It is easy to make ball character using rigidbody2D.
Ball just moves up and down when pressing button.
but when it fall It doesn’t stop as soon as it is colliding.

extends RigidBody2D

var up = 1

func _input(event):
if event.is_action_pressed(“ui_accept”):
up *= -1
gravity_scale = 6 * up

This is my only code used.

Have you added a CollisionShape2D to your RigidBody2D? Is the RigidBody2D colliding with a StaticBody2D that has a shape? I’m not really sure what your question is.

However, I have found a tutorial by BornCG that might be helpful for you: it’s to build a basic platformer, with a jump, gravity, and collisions: https://www.youtube.com/watch?v=HvPTSZl2WCc

I hope you solve your problem.

TheJokingJack | 2021-06-01 20:05