![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | darrentherobot |
I checked my folders and everything and I don’t know what’s wrong with it.
extends CharacterBody2D
class_name Actor
export var speed: = Vector2(300.0, 1000.0)
export var gravity: = 4000.0
var velocity: = Vector2.ZERO
func _physics_process(delta: float) → void:
velocity.y += gravity * delta
velocity = move_and_slide(velocity)
Error message:
res://source/Actors/Actor.gd:6 - Parse Error: Unexpected “Identifier” in class body.
res://source/Actors/Actor.gd:6 - Parse Error: Unexpected “Identifier” in class body.
res://source/Actors/Player.gd:0 - Parse Error: Could not resolve super class inheritance from “Actors”.
Can you post the entire source code for your Actor.gd and your Player.gd?
PolyBytes | 2023-04-30 14:39
Those export var
references need to be @export var
for Godot 4.
jgodfrey | 2023-04-30 18:42
In Godot 4 you must type class name first, then you can extend some other class:
class_name Actor extends CharacterBody2D
Ilja Vost | 2023-04-30 23:31