Made Every building come with a ghost

This commit is contained in:
Florian 2025-09-16 16:13:14 +02:00
parent c67eec8e05
commit 906cd25871
7 changed files with 24 additions and 5 deletions

View file

@ -13,6 +13,9 @@ func _ready() -> void:
position = height * Vector2.from_angle(angle)
grid.buildings.append(self)
for enemy in $EnemyList.get_children():
enemy.reparent(get_parent())
func overlaps(other : Building):
# heights don't overlap
if location.y >= other.location.y + other.dimension.y: return false # other is below

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://djawvtdwp423v"]
[gd_scene load_steps=7 format=3 uid="uid://djawvtdwp423v"]
[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_5j34s"]
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_2yopf"]
[ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_f1gjg"]
[ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_qnfc1"]
[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="5_xr4t5"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_qnfc1"]
resource_local_to_scene = true
@ -21,3 +22,7 @@ material = SubResource("ShaderMaterial_qnfc1")
scale = Vector2(25, 25)
texture = ExtResource("2_2yopf")
script = ExtResource("4_qnfc1")
[node name="EnemyList" type="Node2D" parent="."]
[node name="Ghost" parent="EnemyList" instance=ExtResource("5_xr4t5")]

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bno6flekdwx88"]
[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_q3nfb"]
[node name="HauntedHouse" type="Node2D"]
script = ExtResource("1_q3nfb")

View file

@ -6,8 +6,8 @@ var player : CharacterBody2D
var current_knockback = Vector2.ZERO
var knockback_weight = 800
func _ready() -> void:
player = get_parent().get_node("Player")
func _ready():
player = get_tree().get_root().get_node("main/Player")
func _physics_process(delta: float) -> void:
var motion = -(position - player.position).normalized() * speed

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=7 format=3 uid="uid://cxo6bq26huau7"]
[ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"]
[ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="2_lquwl"]
[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="3_h2yge"]
[ext_resource type="PackedScene" uid="uid://jjoyj1ldafkf" path="res://world/earth.tscn" id="3_lquwl"]

View file

@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/player_walk.png-59515d82f701e5545419ecd7b3460
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
@ -25,6 +27,10 @@ mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false

View file

@ -12,7 +12,7 @@ config_version=5
config/name="The Dark Side of Earth"
run/main_scene="uid://cxo6bq26huau7"
config/features=PackedStringArray("4.4", "Forward Plus")
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg"
[display]