Rudimentary comic/slideshow viewer and intro scene.
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
1 parent
eded968b4e
commit
ddf7942890
25 files changed
+489
-13
No files matched your search
@@ -0,0 +1,48 @@
|
||||
class_name Slideshower
|
||||
extends Control
|
||||
|
||||
signal finished_playing
|
||||
|
||||
var slides = []
|
||||
var slide = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
func play_slideshow(new_slides) -> void:
|
||||
slides = new_slides
|
||||
play_slide(0)
|
||||
|
||||
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)
|
||||
return true
|
||||
|
||||
func next_slide() -> bool:
|
||||
var success = play_slide(slide + 1)
|
||||
if not success:
|
||||
finished_playing.emit()
|
||||
return success
|
||||
|
||||
func prev_slide() -> bool:
|
||||
return play_slide(slide - 1)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_released("interact") or Input.is_action_just_released("jump") or Input.is_action_just_released("move_right"):
|
||||
next_slide()
|
||||
|
||||
if Input.is_action_just_released("move_left"):
|
||||
prev_slide()
|
||||
|
||||
func _on_continue_button_pressed() -> void:
|
||||
next_slide()
|
||||
Reference in new issue
Block a user