Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | scovelme | |
Old Version | Published before Godot 3 was released. |
What I want to happen is when you click a button, it sets the text of a RichTextLabel and makes it visible. Here is my code:
extends TextureButton
# member variables here, example:
# var a=2
# var b="textvar"
func _ready():
set_process(true)
func _input(event):
if(Input.is_mouse_button_pressed(BUTTON_LEFT)): _flumpterado()
func _on_CarCheck_toggled( pressed ):
get_parent().get_parent().get_node("KinematicBody2D").get_node("AnimatedSprite").get_node("CheckPanel").get_node("CheckText").set_bbcode("My car. Nothing more, nothing less.")
get_parent().get_parent().get_node("KinematicBody2D").get_node("AnimatedSprite").get_node("CheckPanel").get_node("CheckText").show()
func _on_CarCheck_pressed():
get_parent().get_parent().get_node("KinematicBody2D").get_node("AnimatedSprite").get_node("CheckPanel").get_node("CheckText").set_bbcode("My car. Nothing more, nothing less.")
get_parent().get_parent().get_node("KinematicBody2D").get_node("AnimatedSprite").get_node("CheckPanel").get_node("CheckText").show()
func _flumpterado():
get_parent().get_parent().get_node("KinematicBody2D").get_node("AnimatedSprite").get_node("CheckPanel").get_node("CheckText").set_bbcode("My car. Nothing more, nothing less.")
get_parent().get_parent().get_node("KinematicBody2D").get_node("AnimatedSprite").get_node("CheckPanel").get_node("CheckText").show()
But the problem is: When I click the button, nothing happens. I don’t know if the RichTextLabel is not becoming visible for some reason, or if the button is not acknowledging the click, or what. But I need help solving it.
Edited to make the code more readable (hint: you have to add 4 spaces before each lines for the code to appear formatted).
Zylann | 2016-11-10 20:31