Invalid operands 'nil' and 'float' in an operator "*"

func _physics_process(delta):
#Gravity for goblin
velocity.y += gravity * delta

After tryping this it said " invalid operands ‘nil’ and ‘float’ in an operator “*” ". How do you fix this? Please help. FULL CODE

extends CharacterBody2D

var gravity = ProjectSettings.get_setting(“physics/2d/defa”)

func _physics_process(delta):
#Gravity for goblin
velocity.y += gravity * delta

func _on_area_2d_body_entered(body):
if body.name == “Player”:
print(“Player”)

This line is incorrect. The path “physics…” is not accurate.
Please use the code tag button (looks like this </>) when posting code.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.