clean up stale test_level files (project uses LevelRuntime now)
This commit is contained in:
@@ -1,116 +0,0 @@
|
||||
extends Node3D
|
||||
class_name TestLevelBuilder
|
||||
## Builds the test level ONLY from code — no .tscn SubResource references.
|
||||
## One-click playtest: attach to TestLevel root, F5.
|
||||
|
||||
func _ready() -> void:
|
||||
build()
|
||||
|
||||
func build() -> void:
|
||||
_build_floor()
|
||||
_build_walls()
|
||||
_build_lighting()
|
||||
_build_player()
|
||||
_build_camera()
|
||||
_build_ui()
|
||||
|
||||
|
||||
func _box_static(pos: Vector3, size: Vector3, color: Color) -> StaticBody3D:
|
||||
var body := StaticBody3D.new()
|
||||
body.name = "Static_" + str(pos)
|
||||
body.position = pos
|
||||
add_child(body)
|
||||
var shape := CollisionShape3D.new()
|
||||
shape.shape = BoxShape3D.new()
|
||||
shape.shape.size = size
|
||||
body.add_child(shape)
|
||||
var mesh := MeshInstance3D.new()
|
||||
mesh.mesh = BoxMesh.new()
|
||||
mesh.mesh.size = size
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.albedo_color = color
|
||||
mesh.mesh.surface_set_material(0, mat)
|
||||
body.add_child(mesh)
|
||||
return body
|
||||
|
||||
|
||||
func _build_floor() -> void:
|
||||
_box_static(Vector3(0, -1.1, 0), Vector3(30, 0.4, 30), Color(0.35, 0.25, 0.15))
|
||||
|
||||
|
||||
func _build_walls() -> void:
|
||||
_box_static(Vector3(0, 3, -15), Vector3(30, 6, 0.4), Color(0.55, 0.45, 0.35))
|
||||
_box_static(Vector3(15, 3, 0), Vector3(0.4, 6, 30), Color(0.55, 0.45, 0.35))
|
||||
_box_static(Vector3(-15, 3, 0), Vector3(0.4, 6, 30), Color(0.55, 0.45, 0.35))
|
||||
|
||||
|
||||
func _build_lighting() -> void:
|
||||
var sun := DirectionalLight3D.new()
|
||||
sun.name = "Sun"
|
||||
sun.position = Vector3(0, 10, 0)
|
||||
sun.rotation_degrees = Vector3(50, 0, 0)
|
||||
sun.light_color = Color(1, 0.95, 0.85)
|
||||
sun.light_energy = 1.1
|
||||
sun.shadow_enabled = true
|
||||
add_child(sun)
|
||||
|
||||
|
||||
func _build_player() -> void:
|
||||
var player := CharacterBody3D.new()
|
||||
player.name = "Player"
|
||||
player.position = Vector3(0, 1.5, 8)
|
||||
add_child(player)
|
||||
var shape := CollisionShape3D.new()
|
||||
shape.shape = CapsuleShape3D.new()
|
||||
shape.shape.radius = 0.4
|
||||
shape.shape.height = 1.8
|
||||
player.add_child(shape)
|
||||
var sm := Node.new()
|
||||
sm.name = "MovementStateMachine"
|
||||
player.add_child(sm)
|
||||
for state_name in ["ground", "air", "wall_run", "wall_cling", "slide", "dash"]:
|
||||
var st := Node.new()
|
||||
st.name = "state_" + state_name
|
||||
sm.add_child(st)
|
||||
var mover_script = load("res://movement/player_movement_controller.gd")
|
||||
if mover_script:
|
||||
player.set_script(mover_script)
|
||||
# set_script after node is in tree does not auto-call _ready()
|
||||
# Manually initialize the controller
|
||||
if player.has_method("_ready"):
|
||||
player._ready()
|
||||
|
||||
|
||||
func _build_camera() -> void:
|
||||
var cam := Camera3D.new()
|
||||
cam.name = "FpsCamera"
|
||||
cam.current = true
|
||||
cam.position = Vector3(0, 1.7, 0)
|
||||
cam.fov = 90.0
|
||||
var player_node = get_node_or_null("Player")
|
||||
if player_node:
|
||||
player_node.add_child(cam)
|
||||
else:
|
||||
add_child(cam)
|
||||
|
||||
|
||||
func _build_ui() -> void:
|
||||
var canvas := CanvasLayer.new()
|
||||
canvas.name = "UI"
|
||||
add_child(canvas)
|
||||
var speed := Label.new()
|
||||
speed.name = "SpeedLabel"
|
||||
speed.offset_left = 16
|
||||
speed.offset_top = 16
|
||||
speed.offset_right = 520
|
||||
speed.offset_bottom = 48
|
||||
speed.text = "Speed: 0.0 m/s | State: --- | Chain: +0%"
|
||||
canvas.add_child(speed)
|
||||
var help := Label.new()
|
||||
help.name = "HelpLabel"
|
||||
help.offset_left = 16
|
||||
help.offset_top = 52
|
||||
help.offset_right = 720
|
||||
help.offset_bottom = 108
|
||||
help.text = "WASD Move | Sprint=Shift | Slide=Ctrl+S | Double-Jump=Space twice | Dash=LShift | Wall-Jump=Jump at wall"
|
||||
canvas.add_child(help)
|
||||
Reference in New Issue
Block a user