Error when trying to make gravity for a platformer in godot 4.4

Error when trying to make gravity for a platformer in godot 4.4
typescript
Ethan Jackson

this is my code

func _physics_process(delta: float) -> void: # Add the gravity. if not is_on_floor(): velocity += gravity * delta coyote_timer += delta else: coyote_timer = 0

velocity += gravity * delta gets the error Invalid operands 'Vector2' and 'float' in operator '+'. pls help

Answer

i fixed it by replacing gravity with get_gravity

Related Articles