am new to gd script

godot-4

	velocity.y+= gravity() * delta

thats the code am having issue with ,and the error finder or whatever in the bottom
Function “gravity()” not found in base self.
sorry am new to pc i swear

When you add a script to a CharacterBody2D it will add a gravity var at the to of the file.

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")

Also, gravity is a variable, not a function.

velocity.y += gravity * delta
1 Like