var VerunStatSprite = {"Verun": preload("res://player.tscn")}
@onready var VerunStatSprite_container = $VerunStatSprite @onready var body_parts_container = $BodyPartsContainer var body_parts_instances = []
func _ready(): # Создаем и добавляем части тела в контейнер for part in body_parts: var instance = body_parts[part].instantiate() body_parts_container.add_child(instance) instance.hide() body_parts_instances.append(instance)
# Создаем экземпляр для VerunStatSprite и добавляем его в контейнер var verun_instance = VerunStatSprite["Verun"].instantiate() VerunStatSprite_container.add_child(verun_instance) verun_instance.hide()
func _input(event): if event is InputEventMouseButton: if event.pressed: hide_VerunStatSprite() show_body_parts() elif event is InputEventMouseMotion: hide_body_parts() show_VerunStatSprite()
func show_body_parts(): for part in body_parts_instances: part.show()
func hide_body_parts(): for part in body_parts_instances: part.hide()
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta): if not is_on_floor(): velocity.y += gravity * delta
if Input.is_action_just_pressed("ui_up") and is_on_floor(): velocity.y = JUMP_VELOCITY
var direction = Input.get_axis("ui_left", "ui_right") if direction: velocity.x = direction * SPEED else: velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
а ещё у меня есть две ошибки. E 0:00:00:0651 _parse_ext_resource: res://player.tscn:12 - Parse Error: [ext_resource] referenced non-existent resource at: res://CharacterBody2D.gd <Исходный код C++>scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource() и E 0:00:00:0652 set_path: Another resource is loaded from path 'res://player.tscn' (possible cyclic resource inclusion). <Ошибка C++> Method/function failed. <Исходный код C++>core/io/resource.cpp:75 @ set_path()
<Исходный код C++>scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()
и E 0:00:00:0652 set_path: Another resource is loaded from path 'res://player.tscn' (possible cyclic resource inclusion).
<Ошибка C++> Method/function failed.
<Исходный код C++>core/io/resource.cpp:75 @ set_path()