This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

This is a 2D Platformer game which features an NPC you can interact with. He opens up a shop screen when interacted with. The shop screen consists of five buttons. One of them is a Leave shop button, three are upgrades, and one is a continue on (Because choosing this will allow passage to progress).

My issue here is I need full controller support and for some reason I can't grab focus of the "Leave" button when the shop opens (that is, when I make the shop screen visible to the player).

The NPC is a KinematicBody 2D, and it has a child node that is a CanvasLayer, with the buttons being children of that. Here's my script :) any help would be very appreciated!

Here's some of the relevant script:

extends KinematicBody2D

var in_area = false
var open = false

onready var anim = get_node("AnimationPlayer")

signal purchase

func ready():
pause
mode = PAUSEMODEPROCESS
$ShopScreen/Bubble.visible = false

func process(delta):
if in
area:
if Input.isactionjustpressed("interact"):
if not open:
open
shop()
elif open:
close_shop()

func openshop():
open = true
anim.play("open")
get
tree().paused = true
#$ShopScreen/Leave.grab_focus()
# I NEED TO GRAB FOCUS HERE BUT ITS NOT WORKING

Godot version 3.5 stable
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.