+1 vote

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
actionpressed("uiaccept"):
up *= -1
gravity_scale = 6 * up

This is my only code used.

Godot version 3.3.2
related to an answer for: Rigidbody2D collision not working properly
in Engine by (17 points)

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.

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.