Hi
Well I usually never ask question but i'm totally baffled so ...
I was having fun experimenting grid managment for a test picross game and eveyrthing went fine until i start trying to get input (keyboard for test purpose)
i got two node here is the code of the child one.
problem is in the input function
it display "Stuff" in console as expected when hitting space but the Stat variable doesn't change value.
if i try to change the value outside the if statement, it does work. but of course it's pointless ....
Also process never seem to happen, here again Stat value stick to 0
Just to be clear i tested input OR _process, just drop them both here for simplicity sake
extends Node2D
var Stat = 0
var Coord = Vector2(0,0)
var Pos = Vector2(0,0)
func _enter_tree():
Pos = Vector2($"..".GrdOri.x,$"..".GrdOri.y)
func _ready():
set_process(true)
func _draw():
if Stat==2:
draw_rect(Rect2(Vector2(Coord.x*($"..".CasSiz+1)+Pos.x,Coord.y*($"..".CasSiz+1)+Pos.y),Vector2(($"..".CasSiz),($"..".CasSiz))),ColorN("white"))
draw_line(Vector2(Coord.x*($"..".CasSiz+1)+Pos.x+$"..".CasCrsLen.x,Coord.y*($"..".CasSiz+1)+Pos.y+$"..".CasCrsLen.x),Vector2(Coord.x*($"..".CasSiz+1)+Pos.x+$"..".CasCrsLen.y,Coord.y*($"..".CasSiz+1)+Pos.y+$"..".CasCrsLen.y),ColorN("red"))
draw_line(Vector2(Coord.x*($"..".CasSiz+1)+Pos.x+$"..".CasCrsLen.y,Coord.y*($"..".CasSiz+1)+Pos.y+$"..".CasCrsLen.x),Vector2(Coord.x*($"..".CasSiz+1)+Pos.x+$"..".CasCrsLen.x,Coord.y*($"..".CasSiz+1)+Pos.y+$"..".CasCrsLen.y),ColorN("red"))
elif Stat==1:
draw_rect(Rect2(Vector2(Coord.x*($"..".CasSiz+1)+Pos.x,Coord.y*($"..".CasSiz+1)+Pos.y),Vector2(($"..".CasSiz),($"..".CasSiz))),ColorN("black"))
else:
draw_rect(Rect2(Vector2(Coord.x*($"..".CasSiz+1)+Pos.x,Coord.y*($"..".CasSiz+1)+Pos.y),Vector2(($"..".CasSiz),($"..".CasSiz))),ColorN("white"))
func _input(event):
if event.is_action_pressed("ui_accept"):
Stat = 1
print("Stuff")
#Stat=1 <- This works
func _process(delta):
Stat=1