Composition Error

Godot Version

Godot 4.3

Question

Hello! Trying to make a game using Composition, wich is something new to me since i have been learning godot for at least 1 month now, i have been following some tutorials, mainly this one: https://www.youtube.com/watch?v=JJid46XzW8A

Everything working fine till i get to the Velocity Module, i get this error that says:
" Cannot call non-static function “is_on_floor()” on the class “CharacterBody2D” directly. Make an instance instead. "

Any idea on how can i fix it? Or maybe another tutorial that i can follow? My code is pretty much the same in the video if that helps. Appreaciate any type of help!

We would need to see your code where you call is_on_floor().
I looked at the video and there doesn’t seem to be anything wrong there.
Also, individual is an export of the type CharacterBody2D. Did you set that to the proper object?

Hello! Just fixed that error, it was a typo… very sad about that. But i got another problem now, everything seems to work fine but when i put the player into the world (with all of the components) it doesnt seems to work, it just floats there. Any idea on how to fix it? I can give parts of the code if needed.

After trying to fix it for a few minutes, i found more errors lol.
"Cannot call method “is_on_floor() on a null value.”

Here is the part of the code:

func handleVelocity(delta):

	if not individual.is_on_floor():
		individual.velocity.y += gravity * delta

	
	if inputNode.getJumpInput() and individual.is_on_floor():
		individual.velocity.y = JUMP_VELOCITY

	
	var direction  = inputNode.getMoveInput()
	if direction:
		individual.velocity.x = direction * currentSpeed
	else:
		individual.velocity.x = move_toward(individual.velocity.x, 0, SPEED)

func activateMove():
	individual.move_and_slide()

I also get another error on the player code, here is the code if that helps:

func _physics_process(delta: float) -> void:
	$Sprite2D.global_position = self.position
	
	if Engine.is_editor_hint():
		return
	
	inputNode.handleMoveInput(delta)
	velocityNode.handleVelocity(delta)
	velocityNode.activateMove()