How to have multiple conections from a buton?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Syl


Here, got a buton wich should change to scenes once pressed from diferent collisionshapes . And it is corectly conected to the diferent collision shapes. Trouble is, it’s always the same scene changed, whatever my collisionshapes’s scripts tells it about their scenes locations… It always keep the last signaled…

Should a buton conect only to one script and object?

:bust_in_silhouette: Reply From: Merlin1846

Try this.

if buttonPressed(collisionshape):
    if == "square":

    if == "triangle":

    if == "circle":

But please note that I don’t think I spelled everything right but that should in general be it. Also when you are attaching signales in the editor, that part that says

if buttonPressed(collisionshape):

should be automatically added to the script when the button’s signal is connected.

Thxs, but i got that:

func _on_Enter_gui_input(event):
		if event is InputEventMouseButton and event.pressed and event.button_index == 1:

on my collisionshape’s scripts… A click mouse for a button, but that works the same. :slight_smile:

Syl | 2020-02-10 15:51