From 8bb2c5c84066423d4346105210f45ed7ccfd106e Mon Sep 17 00:00:00 2001 From: Gregory Marco Date: Sun, 18 Oct 2026 08:11:58 -0500 Subject: [PATCH] Add ability to have two images in a slide. --- Slideshower.tscn | 15 +++++++++++++-- intro.gd | 2 +- slideshower.gd | 21 +++++++++++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Slideshower.tscn b/Slideshower.tscn index efa0e48..db4b064 100644 --- a/Slideshower.tscn +++ b/Slideshower.tscn @@ -30,15 +30,26 @@ split_offset = 642 [node name="ImageFrame" type="Panel" parent="VSplitContainer" unique_id=1582351824] layout_mode = 2 -[node name="SlideImage" type="TextureRect" parent="VSplitContainer/ImageFrame" unique_id=720362532] +[node name="SlideContainer" type="HBoxContainer" parent="VSplitContainer/ImageFrame" unique_id=975465325] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +alignment = 1 + +[node name="SlideImage" type="TextureRect" parent="VSplitContainer/ImageFrame/SlideContainer" unique_id=720362532] +layout_mode = 2 texture = ExtResource("2_puxm7") -expand_mode = 1 +expand_mode = 2 +stretch_mode = 5 + +[node name="SlideImage2" type="TextureRect" parent="VSplitContainer/ImageFrame/SlideContainer" unique_id=746302187] +visible = false +layout_mode = 2 +texture = ExtResource("2_puxm7") +expand_mode = 2 stretch_mode = 5 [node name="TextFrame" type="Panel" parent="VSplitContainer" unique_id=1381001186] diff --git a/intro.gd b/intro.gd index 5f13fbc..caa3c39 100644 --- a/intro.gd +++ b/intro.gd @@ -15,7 +15,7 @@ func _ready() -> void: "text": "Mr. Rhombini excitedly connects the antenna. The sarcophagus begins to hum." }, { "image": "Opensofar", "text": "The sarcophagus swings open to reveal, not a dead body, but an old computer. The computer begins to boot up, but an error message is visible on the main screen." }, - { "image": "PossessedbyOC", + { "images": ["PossessedbyOC", "Power_source"], "text": "However, Mr. Rhombini's attention is instantly grabbed by the other object inside the open sarcophagus." }, { "image": "Glow", "text": "The Pharaoh's jetpack! Mr. Rhombini wastes no time in putting it on." } diff --git a/slideshower.gd b/slideshower.gd index d7743be..30d70f4 100644 --- a/slideshower.gd +++ b/slideshower.gd @@ -14,17 +14,26 @@ func play_slideshow(new_slides) -> void: slides = new_slides play_slide(0) +func _make_image_path(image_name: String) -> String: + if image_name.begins_with("res://"): + return image_name + return "res://art/slides/%s.png" % image_name + func play_slide(index) -> bool: if index < 0 or index >= len(slides): return false slide = index - var image_path: String = slides[index].image - if not image_path.begins_with("res://"): - image_path = "res://art/slides/%s.png" % image_path - - $VSplitContainer/TextFrame/SlideText.text = slides[index].text - $VSplitContainer/ImageFrame/SlideImage.texture = load(image_path) + var slide_object = slides[index] + $VSplitContainer/TextFrame/SlideText.text = slide_object.text + + if "image" in slides[index]: + $VSplitContainer/ImageFrame/SlideContainer/SlideImage.texture = load(_make_image_path(slide_object.image)) + $VSplitContainer/ImageFrame/SlideContainer/SlideImage2.visible = false + else: + $VSplitContainer/ImageFrame/SlideContainer/SlideImage.texture = load(_make_image_path(slide_object.images[0])) + $VSplitContainer/ImageFrame/SlideContainer/SlideImage2.visible = true + $VSplitContainer/ImageFrame/SlideContainer/SlideImage2.texture = load(_make_image_path(slide_object.images[1])) return true func next_slide() -> bool: