mirror of
https://github.com/FOSS-Supremacy/OpenLiberty.git
synced 2025-04-28 11:57:58 +03:00
Implement monke spawner
This commit is contained in:
parent
047c134e74
commit
70af89a79e
3 changed files with 15 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://q5y0ct8qdw8e"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://b6xiqhe5i8bej"]
|
||||
|
||||
[ext_resource type="ArrayMesh" uid="uid://v58ypl1tockm" path="res://meshes/suzanne.obj" id="1_r4k80"]
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ extends Node
|
|||
|
||||
|
||||
@onready var world := Node3D.new()
|
||||
var suzanne := preload("res://prefabs/suzanne.tscn")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -23,3 +24,11 @@ func _ready() -> void:
|
|||
await get_tree().physics_frame
|
||||
print("Map load completed in %f seconds" % ((Time.get_ticks_msec() - start_t) / 1000))
|
||||
add_child(world)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEventKey:
|
||||
if event.physical_keycode == KEY_SPACE and event.pressed:
|
||||
var node := suzanne.instantiate() as RigidBody3D
|
||||
add_child(node)
|
||||
node.global_position = get_viewport().get_camera_3d().global_position
|
||||
|
|
|
@ -59,4 +59,9 @@ offset_right = 222.0
|
|||
offset_bottom = 28.0
|
||||
text = "Map loader test"
|
||||
|
||||
[node name="Label" type="Label" parent="GUI"]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "Press space to spawn Suzanne"
|
||||
|
||||
[node name="flycam" parent="." instance=ExtResource("3_850h8")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue