Looks like you're not logged in

Login or Register to continue

Lesson Q&A

Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.

  • Challenge 2 Using ModuloTheEffingLaw```gdscript extends Control @onready var rich_text_label : RichTextLabel = %RichTextLabel @onready var next_button : Button = %NextButton @onready var previous_button : Button = %PreviousButton var dialogue_text: Array[String] = [ "Hello World", "How are you", "I'm doing great", ] var current_item_index := 0 func _ready() -> void: next_button.connect("pressed", _advance_text) previous_button.pressed.connect(_previous_text) show_text() func _advance_text() -> void: current_item_index += 1 show_text() func _previous_text() -> void: current_item_index -= 1 show_text() func show_text() -> void: rich_text_label.text = dialogue_text[current_item_index % dialogue_text.size()] ``` 3 5 Jun. 29, 2024
  • Question about first challengep_dev_I wanted to disable the previous button when displaying the first item in the array, so I came up with the following code: ```gdscript #... @onready var previous_button: Button = %PreviousButton #... func _ready() -> void: show_text() next_button.pressed.connect(advance) previous_button.disabled = true previous_button.pressed.connect(rewind) #... func advance() -> void: previous_button.disabled = false #... func rewind() -> void: if current_item_index > 0: current_item_index -= 1 show_text() if current_item_index == 0: previous_button.disabled = true ``` Is there a way to improve it? 2 5 Jun. 16, 2024
  • appending an int to an Array[String] doesn't throw any errorsmilk_manHere is what was written in the lesson: ```javascript var letters_list := ["a", "b", "c"] ``` > Thanks to `:=`, Godot infers that `letters_list` is an `Array`. But it does not assume the array will contain *only* strings. It can't guess my intent. So if I write this later, **I won't get an error:** ```gdscript func _ready() -> void: letters_list.append(15) ``` But if we clarify the type like shown: ```gdscript - var letters_list := ["a", "b", "c"] + var letters_list: Array[String] = ["a", "b", "c"] ``` we still don't get an error when appending an **int**. Why? 2 1 Oct. 12, 2024
  • Self Challenge: Running Two Arrays!ArcangelZero7Was inspired to challenge myself a bit. I wanted to document what I did, and what I learned. Hope it's interesting and not too long! :) For the initial lesson, I input my array strings thusly (in the bottom dialogue_items array): ```gdscript extends Control #My custom idea var time_items : Array[String] = [ "September", "October", "November", "December", "2025", ] var time_dialogue_index := 0 var dialogue_items : Array[String] = [ "I'm trying to think.", "I'm trying to remember.", "What was I supposed to do?", "Wait...", "It's already " + time_items[time_dialogue_index] + "?!?", ] var current_item_index := 0 ``` **I had a fun idea:** Turning this learning project into a bit of an example of how I seem to experience time, lol. My initial plan, was that whenever the code reached `dialogue_items[4]`, I increment `time_dialogue_index += 1`. **The expectation:** When `time_dialogue_index == 2`, I get "November" and so-on, until we reach "2025" and quit! **BUT I learned something unexpected:** *A variable within an array only seems to be set when the array is initialized.* I found I kept getting "September", infinitely! An array doesn't check to update variables contained within itself! I thought this was niche but definitely a potential "gotcha" moment. Maybe I could have put the array assignment in `func _process() -> void:` or something, but why get in the habit of wasting clock-cycles like that? :P (As a newb I have a funny habit of under-estimating the insane power of modern computers...maybe too many runaway while-loops in the past...? But I digress.) I made a new function to handle this "time advance" specifically: ```gdscript func advance_time() -> void: #Quit if we've seen it all and would just keep repeating ourselves. if time_dialogue_index == time_items.size() -1 : get_tree().quit() #If everything checks out, advance time! elif current_item_index == 4 && time_dialogue_index < time_items.size() - 1: time_dialogue_index += 1 dialogue_items[4] = ("It's already " + time_items[time_dialogue_index] + "?!?") ``` **Secret Sauce:** The last line here was necessary to *update the 4th array item* on each iteration. I added advance_time() to the advance() function, so it only bothers to check when going forward, and not backwards. :P Hope somebody finds this interesting! 4 1 Aug. 03, 2024
  • Connecting timerHazlarHi! I added a timer so the text scrolls by itself. ```gdscript extends Control @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var timer: Timer = %Timer var current_index : int = 0 var introduction : Array[String] = [ "Question for a Champion !", "Rules: Each question earns 1000€\nOnly one possible answer\n", "First Question !", "Are you an adult ?", "It's a joke for the moment" ] func _ready() -> void: timer.timeout.connect(advance) timer.start() show_text() func advance() -> void: current_index += 1 show_text() func show_text() -> void: if current_index == introduction.size(): timer.timeout.disconnect(advance) else: rich_text_label.text = introduction[current_index] ``` But I wanted to create a version where functions have parameters: ```gdscript extends Control @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var timer: Timer = %Timer var current_index : int = 0 var introduction : Array[String] = [ "Question for a Champion !", "Rules: Each question earns 1000€\nOnly one possible answer\n", "First Question !", "Are you an adult ?", "It's a joke for the moment" ] func _ready() -> void: timer.timeout.connect(advance) show_text(introduction) func advance(sentenceArray: Array[String]) -> void: print("advance!") current_index += 1 show_text(sentenceArray) func show_text(script: Array[String]) -> void: if current_index == script.size(): timer.timeout.disconnect(advance) else: rich_text_label.text = script[current_index] ``` In both versions, the timer is connected to the increment: when it reaches 0 it goes to the advance function but cannot apply the `show_text(sentenceArray)`order because the sentenceArray parameter has not been relayed by anyone due to the fact that the only link that involves `advance()` is the connection of the ***timeout*** signal. And in its formulation, only the name of the function to call is required, thus ignoring the parameter necessary for the proper functioning of the function: `timer.timeout.connect(advance)`. I know that at first glance I am creating a big detour for a simple action, compared to the first version. But I plan to create a table of questions where I would just have to write `show_text(introduction)` then after `show_text(question)` and that it reads itself. then I would create 3 buttons, one per possible answer by editing their group by (answer A, B, C) to check their click. So how could I reconcile the only line that advances the text ( `timer.timeout.connect(advance)`. ) with its parameter? Thank you ! 1 1 Jul. 28, 2024
  • Recommended Instructions Updatesteel_jokersI'd like to recommend an update in the practice instructions for L5.P2: Making a Slideshow. It wasn't clear to me by reading them that the practice was aiming for me to reset the `item_index` when the bound check passed. Initially I handled it as we did in the lesson by quitting the slideshow. (Yes, this means that I deleted the `item_index = 0` code snippet that was originally in the conditional) Adding a line to the instructions to indicate the student should reset the index to 0 when performing the bound check on the items array would've been a bit more clear to me. Alternatively, a comment in the code would equally have assisted in clarity of intent. Consider one, or both, or none: INSTRUCTIONS (add) When you reach the end of the dialogue array, set the index back to the array's first element COMMENT (alternatively add) ```gdscript func advance() -> void: # make sure to increment the 'item_index' if item_index >= items.size(): # reset the index to the first element of the items array item_index = 0 # Don't forget to call the show_text function ``` 1 1 Jul. 13, 2024
  • Slightly different approach to bonus challengesHappyI originally made it so that the next button would wrap and the previous button stops at item 0. However I felt like it was weird that the next button would take you the start of the dialogue, so I made hard stops for the next and previous buttons; that won't proceed any further than the last item or go back any further than the first item. In a more game way the last next button should turn into "finish" or "end dialogue" but that's for another time. Here is my code for the solutions: ```gdscript @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var previous_button: Button = %PreviousButton var dialogue_items : Array[String] = [ "So, you're looking to be a game developer?", "Think you got what it takes?", "I'm sure you'll get there eventually.", "Maybe take it a little slower, or not be so hard on yourself.", ] var current_item_index := 0 func show_text() -> void: var current_item := dialogue_items[current_item_index] rich_text_label.text = current_item func advance() -> void: current_item_index += 1 if current_item_index >= dialogue_items.size(): current_item_index = dialogue_items.size() - 1 show_text() func previous() -> void: current_item_index -= 1 if current_item_index <= 0: current_item_index = 0 show_text() func _ready() -> void: show_text() next_button.pressed.connect(advance) previous_button.pressed.connect(previous) ``` Also found that putting the show_text() in an else statement would stop showcasing item 0 of the array. Taking it out of the else statement seems to work better. 3 0 Nov. 12, 2024
  • Typo in glossary?MuseDoesHi, I was reading the glossary entry that is linked to the [is equivalent to writing] and I think I found a typo. I think it meant to say var x = 10 in the first example as the following example says it can be changed to x = 20. In maths, you might write `let x be 10`.In GDSCript, you would write: ```javascript var x = 20 ``` Contrary to maths, the value assigned to `x` can be *changed* throughout the lifetime of the program, at [runtime](https://school.gdquest.com/glossary/runtime).For example, later, you might write: ```javascript x = 20 ``` 1 0 Nov. 03, 2024
  • Next button problemsilver-foxHi, all works except foe the button states. it beginn black and make the hover animation. But when I click on it it gets in focus-state and maintains this state until the game is closed, after all Strings have been shown. What have I missed? 1 0 Oct. 21, 2024
  • Challenge 1 and 2. My solutions are good?MaziHi! My things are working but what do you think about them? I tried to do it very simple. ```gdscript extends Control @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %Next_Button @onready var previous_button: Button = %Previous_Button #because i wanted to know where I am in the story var dialogue_items: Array[String]= [ "START", "page 1", "page 2", "page 3", "page 4", "page 5", "page 6", "THE END", ] @export var current_item_index := 0 func _ready() -> void: show_text() next_button.pressed.connect(advance) previous_button.pressed.connect(rewind) func show_text()-> void: var current_item := dialogue_items[current_item_index] rich_text_label.text = current_item func advance() -> void: current_item_index += 1 if current_item_index >= dialogue_items.size(): #in challeng 1: if ... == ... #get_tree().quit() #I used this in challenge 1 current_item_index = 0 #I used this only in challenge 2 show_text() func rewind() -> void: current_item_index -= 1 if current_item_index < 0: current_item_index = 0 previous_button.disabled show_text() ``` 3 0 Oct. 09, 2024
  • ctrl + drag Node into script does not declare var type??elastic-kingfisherHello! I am attempting to follow the instructions in the "Create the Script" sub-lesson, where the instruction is to drag a unique node from the scene window, hold ctrl, release click, release ctrl. This mostly works as expected, however, it does not declare the variable type. I instead get this: ```gdscript @onready var rich_text_label = %RichTextLabel @onready var next_button = %NextButton @onready var previous_button = %PreviousButton #and I believe this is instead expected?: @onready var audio_stream_player: AudioStreamPlayer = %AudioStreamPlayer #Please advise! ``` 1 0 Sep. 24, 2024
  • Unit testing in Godotsalty-dinosaurNow that we're starting to get into data handling, does Godot have any built-in tooling for unit tests? I'd love to be able to test my solution without having to open Godot and tap buttons every time. For example, I'd like to write automated tests that `show_text` is called with the correct string depending on how many times the button was pressed. (I totally understand if something like this is outside the scope of these courses however.) I see that there is something in the asset library called GUT, but is this the only currently available solution? 4 0 Sep. 10, 2024
  • Button Hover/Pressed AnimationAbdul Hannan AhmedHi! I just wanted to ask if it is possible to create and theme buttons like the ones who have on website (like the post button in the question forum). I really like the hover and the pressed animation, like the button is actually being pressed. Is it possible to theme buttons that way? If yes, than can you tell or hint as to how? BTW Great course! I am learning quickly and a lot thoroughly enjoying! Keep up the great work! Regards, Abdul Hannan Ahmed 1 0 Sep. 07, 2024
  • Help with the challengesFioretinSo I’ve wrote some codes that should: (1) Set the current_item_index back to 0 after it reaches the end of the array, basically looping it (2) Created a “Previous” button that should rewind the previous text. It’s disabled at the beginning, but should become active as we go through the array The problem here is that it’s not doing any of that. The game closes on its own after reaching the end of the array (it says “Out of bounds get index ‘3’ (on base: ‘Array[String]’), even though I’ve written a code that it should set the current_item_index back to 0. Also, the ‘Previous’ button remains disabled. Here’s my codes: ```gdscript extends Control @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var previous_button: Button = %PreviousButton var dialogue_items : Array[String] = [ "To be or not to be...", "\"The world is what you make of it,\" or so she says.", "Things are about to get interesting!", ] var current_item_index := 0 func show_text() -> void: var current_item := dialogue_items[current_item_index] rich_text_label.text = current_item func _ready() -> void: show_text() next_button.pressed.connect(advance_text) previous_button.disabled = true previous_button.pressed.connect(previous_text) func advance_text() -> void: if current_item_index == dialogue_items.size(): current_item_index = 0 else: current_item_index += 1 show_text() func previous_text() -> void: if current_item_index > 0: previous_button.disabled = false current_item_index -= 1 show_text() if current_item_index == 0: previous_button.disabled = true ``` I’m not sure what went wrong here… Please help… 3 0 Sep. 06, 2024
  • Drag and Drop %Unique Nodes Not Working ProperlyCave Darr This is the second time I'm working through through M7 and M8, and dragging %unique nodes into my script is not work as shown in the tutorial. When I drag and drop multiple nodes into the script, the last selected node is not brought in. When I select only one node, nothing is brought in. I wish I could post video of this happening because it sounds nuts, and no one has posted about this problem yet. Thanks! -Dave 1 0 Aug. 20, 2024
  • My defi question for a champion, i have a question you are the championHazlarHello, I wanted to create a question and answer game, and I found myself with a problem in the 2D view at the level of the display of long words and a problem set up in the script for the left click entry. The code is 101 lines, I don't know if it's a good idea to post it here, if you could give me the link ^ which explains how to share the projects directly by downloading the file, I could share it. Basically I created 3 buttons: slotA, slotB and C then I connected their pressed signal to the on_button_pressed function, only after reflection, I understood the difference between pressed object, object being pressed, because one cannot be identified on the spot while the other can. Do I therefore have to go through area2D in this context? Thanks in advance 7 0 Jul. 31, 2024
  • Size of dialogue_items with .size() methodHazlarHello, In the document, the array.size() method returns the number of elements present in the array counting from 1, but we display the arrays from 0 so this line `if current_item_index == dialogue_items.size():` should be `if current_item_index == dialogue_items.size() - 1:` but it's strange because the array is not fully traversed. 1 0 Jul. 27, 2024
  • Unique Names are Exclusive to Their Sceneslim-lemurSo in this module/lesson, we learn how to give nodes "Unique Names", which has the primary benefit of allowing users to move nodes without re-factoring. (Mainly updating the node paths to that node) It is also said that it can be used to tell which nodes are used in code. However, it then states that nodes with Unique Names can only be used in that scene, i.e. can't be referenced by any other scene. If that's the case, then the whole "tell which nodes are used in code" aspect is more like "tell which nodes are used only in this scene's code", which is more situational. E.g. I wouldn't mark every unique child node AS Unique, as I might want to have other nodes be able to reference them later, like Area2D's. Maybe this limitation is part of a broader "compartmentalization/reducing co-dependencies" best-practice, where it leads to better coding as it encourages us to limit cross-references between scenes to the root nodes, keeping future refactoring simpler. 3 0 Jul. 18, 2024
  • typoInOnesGraveDedJust before the practices, "Now whenyou reach..." Also, I wanted to say that this course is so incredible! 1 0 Jul. 13, 2024
  • Typo in Bound Check glossaryTJHi! The Bound Check glossary contains the following line: `elif character_index >= characters.size() - 1:` But this should probably be one of the following two: `elif character_index >= characters.size():` `elif character_index > characters.size() - 1:` 1 0 Jun. 29, 2024
  • Crashing on AudioStream Part of LessonPurpleHuesI'm having trouble on this part of the lesson just the before the last challenge. When I try to run the scene it crashes and I get this error: "Cannot call method 'get_length' on a null value." No one else seems to have the same problem so I'm stuck, and I'd appreaciate the help. Thanks! extends Control var dialogue_items: Array[String] = [ "Hello There!", "I've been learning to code!", "Someday I'm going to make great games.", "But, it will take a lot of practice-", "and hard work.", "Just remember to keep at it", "Stay Focused!", "Have fun with it", "If things get tough-", "Find a way around it!", "Hang in there!" ] var current_item_index := 0 @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var back_button: Button = %BackButton @onready var audio_stream_player: AudioStreamPlayer = %AudioStreamPlayer func _ready() -> void: show_text() next_button.pressed.connect(advance) back_button.disabled = true back_button.pressed.connect(rewind) func advance() -> void: back_button.disabled = false current_item_index += 1 if current_item_index == dialogue_items.size(): get_tree() else: show_text() if current_item_index == 10: current_item_index = -1 func show_text() -> void: var current_item := dialogue_items[current_item_index] rich_text_label.text = current_item rich_text_label.visible_ratio = 0.0 var tween := create_tween() var text_appearing_duration := 1.2 tween.tween_property(rich_text_label, "visible_ratio", 1.0, text_appearing_duration) ERROR HERE! -> var sound_max_length := audio_stream_player.stream.get_length() - text_appearing_duration var sound_start_position := randf() * sound_max_length audio_stream_player.ply(sound_start_position) tween.finished.connect(audio_stream_player.stop) func rewind() -> void: if current_item_index > 0: current_item_index -= 1 show_text() if current_item_index == 0: back_button.disabled = true 3 0 Jun. 24, 2024
  • Practice 2 fail but I think I'm right ChanclinkI don't think my code is wrong, I even tried changing the code so that it loops back, asked in challenge 2, but nothing seems to work, the third check is wrong. Here is my code : `extends ColorRect` `var items: Array[String] = [` `"Strings. Ints. Floats. Nulls.",` `"Long ago, the four types lived together in harmony.",` `"Then, everything changed when the typed Array arrived.",` `"Only the Programmer, student of all types, could stop them.",` `"But when the world needed them most, they were studying on GDQuest.",` `]` `var item_index := 0` `@onready var rich_text_label: RichTextLabel = %RichTextLabel` `@onready var button: Button = %Button` `func _ready() -> void:` `button.pressed.connect(advance)` `show_text()` `func show_text() -> void:` `# Make sure to display the text` `var current_item := items[item_index]` `rich_text_label.text = current_item` `# Increments the index each time is called.` `func advance() -> void:` `# make sure to increment the `item_index` `item_index += 1` `if item_index >= items.size():` `item_index = 0` `else:` `show_text()` `# Don't forget to call the show_text function` I tried with return instead of item_index = 0, in the advance() function and even get_tree().quit() but it closes the game instantly, 4 0 Jun. 11, 2024
  • Bound check errorChanclinkI tried doing the bound check on my own before looking at the solution and I came up with this : `func advance() -> void:` `if current_item_index > dialogue_items.size():` `return` `current_item_index += 1` `show_text()` but It didn't work, I tried other thing like using a variable instead of directly `dialogue_items.size()` but nothing worked. Edit : While writing this I've found the 2 problems : - the operator of the "if" must be ">=" because the index starts at 0. - `current_item_index += 1` needs to be before everything, and **it applies to the solution too**, be careful I made the mistake for both (since we don't see it in the little code exemple I did not thought about it, maybe you should add the line ?) Just wanted to let people now in case someone is in the same situation as me BTW, I love the fact that you had a bit more humor in your lessons, makes the course more fun "Godot HATES me" 1 0 Jun. 10, 2024
  • My text box is appearing way larger than in the tutorialold-fashioned-elephantSo, I am midway through this section but I noticed that my text box is appearing way larger than it looks in the tutorial. I don't totally know how to explain this well but it looks like there could be another few lines of text below the initial line when I test the scene. I was wondering if I did something wrong so I checked my work against the solutions book and I see the same thing happening. It's not a huge deal I guess but I'd love to figure out why this is happening. 2 0 May. 31, 2024
  • Displayed TextmarinatonEdit: I accidentally chose the wrong lesson. The information below applies to the next lesson, L6 During runtime there is a chance that letters of a word may start to appear and then move on to the next line. I found a setting that fixes it: RichTextLabel > Displayed Text > Visible Characters Behavior > Characters After Shaping (instead of default Characters Before Shaping) [https://imgur.com/a/yHMMUEk](https://imgur.com/a/yHMMUEk) 1 0 May. 28, 2024
  • Added full cicle to phrases.VilldarI've edited the script so you can only cicle between phrases. Also changed the visibility of buttons based on the index. Don't know if is correct or not, I was just experiment, so feel free to critique. ```gdscript extends Control @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var back_button: Button = %BackButton var dialogue_items : Array[String] = [ "I'm learning about Arrays...", "...and it is a little bit complicated.", "Let's see if I got it right: an array is a list of values!", "Did I get it right? Did I?", "Hehe! Bye bye~!" ] var current_item_index := 0 func _ready() -> void: show_text() next_button.pressed.connect(advance) back_button.pressed.connect(rewind) back_button.visible = false func show_text() -> void: var current_item := dialogue_items[current_item_index] rich_text_label.text = current_item func advance() -> void: current_item_index += 1 back_button.visible = true if current_item_index >= dialogue_items.size() - 1: next_button.visible = false current_item_index = dialogue_items.size() - 1 show_text() func rewind() -> void: current_item_index -= 1 next_button.visible = true if current_item_index <= 0: current_item_index = 0 back_button.visible = false show_text() ``` 2 0 May. 26, 2024
  • Challenge 2 is already codedandrea-putortiHey there, the 2nd challenge of the practice (SPOILER: where you could set the index to 0), it's already done in the script: ```gdscript if item_index >= items.size(): item_index = 0 ``` 1 0 May. 21, 2024
  • Bonus Challenges!AJ StudiosI was able to complete the 1st challenge. After adding the second button to the scene I can see how the focus state works on the buttons. For the second challenge I was able to make it loop but I encountered an interesting behavior. Once I reach the end of the array and click next, nothing happens. When I click next again then it then loops back to the beginning. Why that pause before looping? Also, I wasn't able to make it loop when clicking the previous button due to the out of bounds error. ```gdscript extends Control @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var next_button: Button = %NextButton @onready var prev_button: Button = %PrevButton var dialogue_items: Array[String] = [ "Strings. Ints. Floats. Nulls.", "Long ago, the four types lived together in harmony.", "Then, everything changed when the typed Array arrived.", "Only the Programmer, student of all types, could stop them.", "But when the world needed them most, they were studying on GDQuest.", ] var current_item_index := 0 func _ready() -> void: show_text() next_button.pressed.connect(advance) prev_button.pressed.connect(rewind) func show_text() -> void: var current_item := dialogue_items[current_item_index] rich_text_label.text = current_item func advance() -> void: current_item_index += 1 if current_item_index == dialogue_items.size(): current_item_index = 0 #why the pause before looping? else: show_text() func rewind() -> void: current_item_index -= 1 if current_item_index == 0: current_item_index -= 1 #how can I fix the out of bounds error here? else: show_text() ``` 5 0 May. 19, 2024
  • Why doesn't `advance()` throw an error before arriving at the bound check?SingleMom420My understanding was that functions run their code from top to bottom sequentially. In our `advance()` function, we first iterate current_item_index and only after that run the bound check. Shouldn't this mean that after the last current_item_index iteration and before the bound check is run, there is a moment when we've set current_item_index to [5], which is out of bounds and should throw an error? Or is it because we don't try to do anything with this out of bounds index that prevents the error from being thrown? In other words, is it possible to iterate indexes of arrays beyond their bounds as long as you don't try to do something with this out-of-bounds index? 2 0 May. 17, 2024
  • Small typoaramplThanks to `:=`, Godot infers that `letters` is an... Thanks to `:=`, Godot infers that `letters_list` is an... 1 0 May. 17, 2024
  • Practice 1 bugged for meSingleMom420The correct answer appears on runtime, but the GDquest checker on the left says I picked a different answer (a different array index). 3 0 May. 16, 2024
  • Out of bounds error on practice 2.TheKmankBeen having issues getting an out of bounds error in practice 2 and not sure why: ```gdscript extends ColorRect @onready var rich_text_label: RichTextLabel = %RichTextLabel @onready var button: Button = %Button var items: Array[String] = [ "Strings. Ints. Floats. Nulls.", "Long ago, the four types lived together in harmony.", "Then, everything changed when the typed Array arrived.", "Only the Programmer, student of all types, could stop them.", "But when the world needed them most, they were studying on GDQuest.", ] var item_index := 0 func _ready() -> void: button.pressed.connect(advance) show_text() func show_text() -> void: # Make sure to display the text var item := items[item_index] rich_text_label.text = item # Increments the index each time is called. func advance() -> void: # make sure to increment the `item_index` if item_index >= items.size(): item_index = 0 # Don't forget to call the show_text function else: item_index += 1 show_text() ``` 3 0 May. 13, 2024
Site is in BETA!found a bug?