Version 0.1 - 0.3.1
Added the World Added Mobs, and spawning those mobs at runtime Added simple camera movement Added simple UI/HUD
This commit is contained in:
23
scenes/spawner/advanced_spwaner.gd
Normal file
23
scenes/spawner/advanced_spwaner.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends Node
|
||||
|
||||
@export var scenes: Array[PackedScene]
|
||||
|
||||
# Spawn the corresponding Entity at position
|
||||
func spawn_entity(index, position):
|
||||
var entity = scenes[index].instantiate()
|
||||
|
||||
if entity is Node2D:
|
||||
entity.position = position
|
||||
|
||||
add_child(entity)
|
||||
|
||||
return entity
|
||||
|
||||
|
||||
|
||||
|
||||
func spawn_fly(position):
|
||||
return spawn_entity(0, position)
|
||||
|
||||
func spawn_bee(position):
|
||||
return spawn_entity(1, position)
|
||||
1
scenes/spawner/advanced_spwaner.gd.uid
Normal file
1
scenes/spawner/advanced_spwaner.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dkc807nt6d5jb
|
||||
17
scenes/spawner/spawner.gd
Normal file
17
scenes/spawner/spawner.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Node
|
||||
|
||||
const FlyScene = preload("res://scenes/entities/fly/fly.tscn")
|
||||
|
||||
func spawn_entity(entity_scene, position):
|
||||
# Instance the scene
|
||||
var entity = entity_scene.instantiate()
|
||||
|
||||
if entity is Node2D:
|
||||
entity.position = position
|
||||
|
||||
add_child(entity)
|
||||
|
||||
return entity
|
||||
|
||||
func spawn_fly(position):
|
||||
return spawn_entity(FlyScene, position)
|
||||
1
scenes/spawner/spawner.gd.uid
Normal file
1
scenes/spawner/spawner.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dxflnn04s7out
|
||||
17
scenes/spawner/spawner.tscn
Normal file
17
scenes/spawner/spawner.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://drwdehf7caidt"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dkc807nt6d5jb" path="res://scenes/spawner/advanced_spwaner.gd" id="1_eoeca"]
|
||||
[ext_resource type="PackedScene" uid="uid://imihi2lpdd0r" path="res://scenes/entities/fly/fly.tscn" id="2_wtxcb"]
|
||||
[ext_resource type="PackedScene" uid="uid://b43wgesnaq4eg" path="res://scenes/entities/bumblebee/bumblebee.tscn" id="3_uhn3r"]
|
||||
[ext_resource type="Texture2D" uid="uid://b6wg3uyaeju7u" path="res://art/spawner_fallback.png" id="4_byvvi"]
|
||||
|
||||
[node name="Spawner" type="Node2D"]
|
||||
script = ExtResource("1_eoeca")
|
||||
scenes = Array[PackedScene]([ExtResource("2_wtxcb"), ExtResource("3_uhn3r")])
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="."]
|
||||
top_level = true
|
||||
gizmo_extents = 324.1
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("4_byvvi")
|
||||
Reference in New Issue
Block a user