I am new to godot so learning how to use the various nodes available on a first projet.
I am planning to make a simple game consisting of several cards placed face down. Then choosing cards to find the matching pairs. then place new cards face down and play again.
To make it easier, I use Texture buttons for the cards. (would you use something else?) . So I start back loading the back cover texture on all the cards in the grid. Then when someone clicks on a card (texture button) the signal leads to a call back function that loads the front card picture.
This works but when I have a winning pair, I would like to highlight these cards (eventually animate by blinking them or something like this). But it seems that:
- I can not draw on the texture from the initial callback context following the press event. I can only draw from the _draw function.
- when I move code from the callback to the _draw function, I have to resort to variables to condition whether to draw or not in _draw. is it how we are supposed to do this in Godot?
- I can not get a timer timeout to work. The function just continues without waiting for the timeout signal.
I am using something like this (t being a timer node)
func wait (s): print('wait ' + str(s)) t.set_wait_time(s) t.set_one_shot(true) t.start() yield(t, "timeout") print('timeout ' + str(s))
Any reason for this?