basic ECS spawner
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
extends "res://addons/Free fly camera/Src/free_fly_startup.gd"
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
@@ -1 +0,0 @@
|
||||
uid://e6ihddcgve8c
|
||||
@@ -1,6 +1,10 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cohmqsk3s70yp"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cohmqsk3s70yp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cg0xoblykx4w6" path="res://maps/world.gd" id="1_3cfne"]
|
||||
[ext_resource type="Script" uid="uid://cte4jalives85" path="res://addons/sk_fly_camera/src/fly_camera.gd" id="1_aj441"]
|
||||
[ext_resource type="Script" uid="uid://cdu5tlyk72uu4" path="res://addons/gecs/ecs/world.gd" id="1_i46j0"]
|
||||
[ext_resource type="PackedScene" uid="uid://b2v1bngfh5te" path="res://GECS/systems/default_systems.tscn" id="4_3cfne"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0075ch03hfri" path="res://GECS/entities/Spawner/SpawnPoint.tscn" id="5_qsrji"]
|
||||
|
||||
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_aj441"]
|
||||
|
||||
@@ -17,7 +21,17 @@ ssao_enabled = true
|
||||
ssao_radius = 2.0
|
||||
fog_light_color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_qsrji"]
|
||||
|
||||
[node name="Enemies" type="Node3D"]
|
||||
script = ExtResource("1_3cfne")
|
||||
|
||||
[node name="World" type="Node" parent="."]
|
||||
script = ExtResource("1_i46j0")
|
||||
system_nodes_root = NodePath("../Systems")
|
||||
metadata/_custom_type_script = "uid://cdu5tlyk72uu4"
|
||||
|
||||
[node name="Systems" parent="." instance=ExtResource("4_3cfne")]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_i46j0")
|
||||
@@ -30,10 +44,24 @@ transform = Transform3D(0.098757595, -0.94823945, -0.30180964, 0.25508866, -0.26
|
||||
light_energy = 0.2
|
||||
|
||||
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13.231003, 12.216311, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.7689972, 2.2163115, 6)
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_aj441")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
|
||||
shape = SubResource("SphereShape3D_qsrji")
|
||||
|
||||
[node name="SpawnPoint" parent="." instance=ExtResource("5_qsrji")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 2, 1)
|
||||
spawn_frequency = 2.0
|
||||
|
||||
[node name="SpawnPoint2" parent="." instance=ExtResource("5_qsrji")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 2, -21)
|
||||
|
||||
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="."]
|
||||
use_collision = true
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
size = Vector3(100, 1, 100)
|
||||
@@ -87,7 +115,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.025868, -9.536743e-07, 8.9
|
||||
size = Vector3(10, 8, 10)
|
||||
|
||||
[node name="CSGBox3D14" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.727036, -9.536743e-07, 0.6610918)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.7270355, -9.536743e-07, 0.6610918)
|
||||
size = Vector3(10, 9, 10)
|
||||
|
||||
[node name="CSGBox3D15" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
|
||||
124
maps/enemies.tscn101497640.tmp
Normal file
124
maps/enemies.tscn101497640.tmp
Normal file
@@ -0,0 +1,124 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cohmqsk3s70yp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cg0xoblykx4w6" path="res://maps/world.gd" id="1_3cfne"]
|
||||
[ext_resource type="Script" uid="uid://cte4jalives85" path="res://addons/sk_fly_camera/src/fly_camera.gd" id="1_aj441"]
|
||||
[ext_resource type="Script" uid="uid://cdu5tlyk72uu4" path="res://addons/gecs/ecs/world.gd" id="1_i46j0"]
|
||||
[ext_resource type="PackedScene" uid="uid://b2v1bngfh5te" path="res://GECS/systems/default_systems.tscn" id="4_3cfne"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0075ch03hfri" path="res://GECS/entities/Spawner/SpawnPoint.tscn" id="5_qsrji"]
|
||||
|
||||
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_aj441"]
|
||||
|
||||
[sub_resource type="Sky" id="Sky_o2inx"]
|
||||
sky_material = SubResource("PhysicalSkyMaterial_aj441")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_i46j0"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_o2inx")
|
||||
ambient_light_source = 2
|
||||
ambient_light_color = Color(0.77807873, 0.8451813, 0.8615737, 1)
|
||||
ambient_light_energy = 0.5
|
||||
ssao_enabled = true
|
||||
ssao_radius = 2.0
|
||||
fog_light_color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_qsrji"]
|
||||
|
||||
[node name="Enemies" type="Node3D"]
|
||||
script = ExtResource("1_3cfne")
|
||||
|
||||
[node name="World" type="Node" parent="."]
|
||||
script = ExtResource("1_i46j0")
|
||||
system_nodes_root = NodePath("../Systems")
|
||||
metadata/_custom_type_script = "uid://cdu5tlyk72uu4"
|
||||
|
||||
[node name="Systems" parent="." instance=ExtResource("4_3cfne")]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_i46j0")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.6725735, -0.5947325, 0.44038418, -0.74003035, -0.5405202, 0.40024132, 0, -0.5950894, -0.8036596, 0, 0, 0)
|
||||
|
||||
[node name="DirectionalLight3D2" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.098757595, -0.94823945, -0.30180964, 0.25508866, -0.26903492, 0.92873573, -0.96186113, -0.16870806, 0.21531586, 0, 0, 0)
|
||||
light_energy = 0.2
|
||||
|
||||
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.7689972, 2.2163115, 6)
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_aj441")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
|
||||
shape = SubResource("SphereShape3D_qsrji")
|
||||
|
||||
[node name="SpawnPoint" parent="." instance=ExtResource("5_qsrji")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 2, 1)
|
||||
spawn_frequency = 0.2
|
||||
|
||||
[node name="SpawnPoint2" parent="." instance=ExtResource("5_qsrji")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 2, -21)
|
||||
spawn_frequency = -1.0
|
||||
|
||||
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="."]
|
||||
use_collision = true
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
size = Vector3(100, 1, 100)
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.389802, -9.536743e-07, -17.424805)
|
||||
size = Vector3(2, 10, 2)
|
||||
|
||||
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.554723, 0, -14.582476)
|
||||
size = Vector3(2, 10, 2)
|
||||
|
||||
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.554723, 0, 8.672777)
|
||||
size = Vector3(2, 10, 2)
|
||||
|
||||
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.4320955, 0, 8.672777)
|
||||
size = Vector3(2, 10, 2)
|
||||
|
||||
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.400285, 0, -3.0115404)
|
||||
size = Vector3(2, 10, 2)
|
||||
|
||||
[node name="CSGBox3D7" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3954687, -9.536743e-07, -8.965862)
|
||||
size = Vector3(10, 2, 10)
|
||||
|
||||
[node name="CSGBox3D8" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.063101, -9.536743e-07, -6.855488)
|
||||
size = Vector3(10, 3, 10)
|
||||
|
||||
[node name="CSGBox3D9" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.932084, 0, -3.5338726)
|
||||
size = Vector3(10, 4, 10)
|
||||
|
||||
[node name="CSGBox3D10" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.932084, 0, 1.561698)
|
||||
size = Vector3(10, 5, 10)
|
||||
|
||||
[node name="CSGBox3D11" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.3916206, -1.9073486e-06, 9.662505)
|
||||
size = Vector3(10, 6, 10)
|
||||
|
||||
[node name="CSGBox3D12" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.696065, -9.536743e-07, 12.753594)
|
||||
size = Vector3(10, 7, 10)
|
||||
|
||||
[node name="CSGBox3D13" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.025868, -9.536743e-07, 8.954356)
|
||||
size = Vector3(10, 8, 10)
|
||||
|
||||
[node name="CSGBox3D14" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.7270355, -9.536743e-07, 0.6610918)
|
||||
size = Vector3(10, 9, 10)
|
||||
|
||||
[node name="CSGBox3D15" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17.384857, -9.536743e-07, -3.8720686)
|
||||
size = Vector3(10, 10, 10)
|
||||
119
maps/main.tscn
Normal file
119
maps/main.tscn
Normal file
File diff suppressed because one or more lines are too long
24
maps/world.gd
Normal file
24
maps/world.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var world: World = $World
|
||||
|
||||
@onready var spawn_point: E_SpawnPoint = $SpawnPoint
|
||||
@onready var spawn_point_2: E_SpawnPoint = $SpawnPoint2
|
||||
|
||||
func _ready():
|
||||
ECS.world = world
|
||||
|
||||
#var player_scene = preload("res://GECS/entities/BasicEnemy/BasicEnemy.tscn") # Adjust path as needed
|
||||
#var basic_enemy = player_scene.instantiate() as BasicEnemy
|
||||
#
|
||||
#add_child(basic_enemy) # Add to scene tree
|
||||
ECS.world.add_entity(spawn_point)
|
||||
ECS.world.add_entity(spawn_point_2)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if ECS.world:
|
||||
ECS.process(delta, "gameplay")
|
||||
|
||||
func _physics_process(delta):
|
||||
if ECS.world:
|
||||
ECS.process(delta, "physics")
|
||||
1
maps/world.gd.uid
Normal file
1
maps/world.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cg0xoblykx4w6
|
||||
Reference in New Issue
Block a user