How to create a character selection screen with two players?

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

I’m trying to make a character selection screen with two players.

I basically need two rectangles hovering over a grid to select the chosen play.

You can think of a grid composed with the following elements:

 TextureButton{
    -TextureRect  
}

Each texture rect is a character avatar, and I use the focus texture of the texture button to overlay a selection rectangle above each texture.

Right now i’m facing two problems:

-How to program the two keyboard inputs separately.
-How to grab_focus() of two buttons simultaneously.

For defining which player pressed which button I am doing:

func _on_baseTextureButton_gui_input(event):
if event.is_action_pressed("special"):
	Global.Player1 = playerObject
if event.is_action_pressed("special2"):
	Global.Player2 = playerObject
pass # Replace with function body.

I hope I have been clear.

Thanks in advance.

:bust_in_silhouette: Reply From: Luftensteiner

Maybe use Viewports.
You can start different scenes in different viewports.