- Edited
Hi everyone. I am a beginner in GD script and I am learning via tutorials on how to make games. I just stumbled upon an issue which says:
Function "is_on_floor()" not found in base self.
Here is my code:
extends Actor
func _physics_process(delta: float) -> void:
var motion = Vector2(0, 20)
var collision =move_and_collide(motion)
var velocity: = Vector2.ZERO
var speed: = Vector2(3.0, 1000.0)
var direction := Vector2(
Input.get_action_strength("move_left") - Input.get_action_strength("move_right"),
-1.0 if Input.is_action_just_pressed("jump") && is_on_floor() else 1.0)
velocity = speed * direction
move_and_collide(velocity)`