Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ashish |
Hello,
When add_points as below, an extra random line is created. Not sure why.
$line.add_point(btn_positions[0]) $line.add_point(btn_positions[1])
I have added two points and only one line should be created. However, one random line shoots off from point number one.
Thanks for your help.
Your image isn’t working. Are you sure your line only contains 2 points? What does this return?
print($line.get_point_count())
jgodfrey | 2020-09-08 20:40
Print is indeed giving 3.
Will try and share the screenshot again.
RandomLineGenerated.jpg - Google Drive
Thanks
ashish | 2020-09-09 10:35
Here is the code block:
func _on_btn1_pressed():
print(“btn1”)
if current_button == “none”:
current_button = “btn1”
$btn1.set_texture_pressed(load(“res://GFX/wrong_button.png”))
$btn2.set_texture_pressed(load(“res://GFX/btn_pressed.jpg”))
$ASP.stream = load(“res://SFX/one.wav”)
$ASP.play(0)
else:
$ASP.stream = load(“res://SFX/wrong.wav”)
$ASP.play(0)
func _on_btn2_pressed():
print(“btn2”)
if current_button == “btn1”:
$line.add_point(btn_positions[0])
$line.add_point(btn_positions1)
current_button = “btn2”
$btn2.set_texture_pressed(load(“res://GFX/wrong_button.png”))
$btn3.set_texture_pressed(load(“res://GFX/btn_pressed.jpg”))
$ASP.stream = load(“res://SFX/two.wav”)
$ASP.play(0)
else:
$ASP.stream = load("res://SFX/wrong.wav")
$ASP.play(0)
ashish | 2020-09-09 10:48