Setup for dynamic elevator floor buttons

Add a button scene, as well as a button scene. Each button has an Area3D to detect collisons; a two-row sprite sheet contains all of the numbers and their on/off state.
This commit is contained in:
Henry Faber 2026-05-16 15:58:45 +01:00
parent acb10d18a4
commit 189823e8bf
9 changed files with 219 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byiom6ry6bpb0"
path.s3tc="res://.godot/imported/button_numbers_off.png-f90b8a095c628051a8864ba56881c222.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://images/button_numbers_off.png"
dest_files=["res://.godot/imported/button_numbers_off.png-f90b8a095c628051a8864ba56881c222.s3tc.ctex"]
[params]
compress/mode=2
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
mipmaps/generate=true
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
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://clq8kuda5vqmp"
path="res://.godot/imported/button_numbers_on.png-0c2a0410b3dffb3bf3ddc212b6ed8fca.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://images/button_numbers_on.png"
dest_files=["res://.godot/imported/button_numbers_on.png-0c2a0410b3dffb3bf3ddc212b6ed8fca.ctex"]
[params]
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
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
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
images/elevator_numbers.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8bw5fmr1vkjn"
path="res://.godot/imported/elevator_numbers.png-e2537b808ebcb9c754433d5782854ffb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://images/elevator_numbers.png"
dest_files=["res://.godot/imported/elevator_numbers.png-e2537b808ebcb9c754433d5782854ffb.ctex"]
[params]
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
mipmaps/generate=true
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
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

75
scenes/button_panel.tscn Normal file
View file

@ -0,0 +1,75 @@
[gd_scene format=3 uid="uid://cnjn0vhg1phav"]
[ext_resource type="PackedScene" uid="uid://bw1kbbl3n83e8" path="res://scenes/floor_button.tscn" id="1_lff67"]
[node name="ButtonPanel" type="Node3D" unique_id=1270714626]
[node name="FloorButtons" type="Node3D" parent="." unique_id=1608506954]
[node name="00" parent="." unique_id=1628684586 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.360477, 0)
[node name="01" parent="." unique_id=1324476691 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.8598118, 0)
[node name="ButtonSprite" parent="01" index="0" unique_id=1628684586]
frame = 1
[node name="02" parent="." unique_id=1143590285 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.3875825, 0)
[node name="ButtonSprite" parent="02" index="0" unique_id=1628684586]
frame = 2
[node name="03" parent="." unique_id=1467372561 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.03961301, 0)
[node name="ButtonSprite" parent="03" index="0" unique_id=1628684586]
frame = 3
[node name="04" parent="." unique_id=652433944 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3832786, 0)
[node name="ButtonSprite" parent="04" index="0" unique_id=1628684586]
frame = 4
[node name="05" parent="." unique_id=470439905 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.842876, 0)
[node name="ButtonSprite" parent="05" index="0" unique_id=1628684586]
frame = 5
[node name="06" parent="." unique_id=1293107230 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.1931896, 0)
[node name="ButtonSprite" parent="06" index="0" unique_id=1628684586]
frame = 6
[node name="07" parent="." unique_id=1309697731 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.632162, 0)
[node name="ButtonSprite" parent="07" index="0" unique_id=1628684586]
frame = 7
[node name="08" parent="." unique_id=447931949 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7.0681796, 0)
[node name="ButtonSprite" parent="08" index="0" unique_id=1628684586]
frame = 8
[node name="09" parent="." unique_id=1200513083 instance=ExtResource("1_lff67")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.490524, 0)
[node name="ButtonSprite" parent="09" index="0" unique_id=1628684586]
frame = 9
[editable path="00"]
[editable path="01"]
[editable path="02"]
[editable path="03"]
[editable path="04"]
[editable path="05"]
[editable path="06"]
[editable path="07"]
[editable path="08"]
[editable path="09"]

19
scenes/floor_button.tscn Normal file
View file

@ -0,0 +1,19 @@
[gd_scene format=3 uid="uid://bw1kbbl3n83e8"]
[ext_resource type="Texture2D" uid="uid://8bw5fmr1vkjn" path="res://images/elevator_numbers.png" id="1_4clxj"]
[sub_resource type="BoxShape3D" id="BoxShape3D_4clxj"]
size = Vector3(1.1594238, 1, 0.055664063)
[node name="FloorButton" type="Area3D" unique_id=265465826]
[node name="ButtonSprite" type="Sprite3D" parent="." unique_id=1628684586]
billboard = 1
texture_filter = 0
texture = ExtResource("1_4clxj")
hframes = 10
vframes = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1160314093]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.361)
shape = SubResource("BoxShape3D_4clxj")

View file

@ -6,6 +6,7 @@
[ext_resource type="PackedScene" uid="uid://bkqwi2yqa0nvg" path="res://scenes/virtua_hand.tscn" id="5_71j4m"] [ext_resource type="PackedScene" uid="uid://bkqwi2yqa0nvg" path="res://scenes/virtua_hand.tscn" id="5_71j4m"]
[ext_resource type="PackedScene" uid="uid://cwwexawpj46hk" path="res://scenes/elevator_button.tscn" id="5_qfnet"] [ext_resource type="PackedScene" uid="uid://cwwexawpj46hk" path="res://scenes/elevator_button.tscn" id="5_qfnet"]
[ext_resource type="Script" uid="uid://c6v2lhrkeup5i" path="res://scenes/world.gd" id="5_world"] [ext_resource type="Script" uid="uid://c6v2lhrkeup5i" path="res://scenes/world.gd" id="5_world"]
[ext_resource type="PackedScene" uid="uid://cnjn0vhg1phav" path="res://scenes/button_panel.tscn" id="7_i7141"]
[sub_resource type="BoxShape3D" id="BoxShape3D_k0juu"] [sub_resource type="BoxShape3D" id="BoxShape3D_k0juu"]
size = Vector3(3.8, 6.6328125, 0.8612671) size = Vector3(3.8, 6.6328125, 0.8612671)
@ -61,6 +62,9 @@ max_distance = 30.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.24584353, 2.8164063, -0.56969166) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.24584353, 2.8164063, -0.56969166)
shape = SubResource("BoxShape3D_k0juu") shape = SubResource("BoxShape3D_k0juu")
[node name="ButtonPanel" parent="ElevatorSafeZone" unique_id=1270714626 instance=ExtResource("7_i7141")]
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 3.4193654, 2.2598982, -0.39259052)
[node name="SurvivorSpawn" type="Marker3D" parent="." unique_id=1095768768] [node name="SurvivorSpawn" type="Marker3D" parent="." unique_id=1095768768]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9181392, 13.711893) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9181392, 13.711893)