So...I was just thinking to try create Black Jack game with Godot. I have created PNG:s of all the cards and dragged them in to my project in Cards -folder.

Then I created table and put couple of buttons there. But now with the code...is it possible to tell Godot what is the value of each card? So when pressing START -button the game randomly gives a card....well You all know how Black Jack works...but the question is: Is it possible to tell Godot what is the value for example King_hearts.png....Queen_hearts.png and so on.

You could use a Dictionary to map the texture to a value. I have not tried it myself, but something like this may work, at least in theory:

var texture_to_value = {
	preload(“King_Hearts.png”):13
	preload(“Queen_Hearts.png”):12
	preload(“Jack_Hearts.png”):11
	preload(“Ten_Hearts.png”):10
	# and so on
}
a year later
1 post was split to spam.
2 months later