Hey guys,
i'm new to Godot and I'm currently working on my first project. A simple TicTacToe. I don't know how many different solutions I've tried, without success :( So far I've always worked with Java, which is why Godot is completely new to me. My goal is to have two players take turns playing. After player X has bet, it's player O and so on. The game should also run on Android, and I can’t just say that player O uses the left mouse button and player X uses the right mouse button. My problem now is this: If I press the left mouse button, the O_Texture is set if I press the left mouse button in the next field O is set again, and so on until O has been set on the entire playing field. I think this will be because the code is executed so quickly that it interprets once clicking as twice. But it's best to take a look at the code yourself . I hope you understand my English, because I partly worked with Google Translate :)
func _on_POS_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
var currentPlayer = x
if event.button_index == BUTTON_LEFT and event.pressed:
if(currentPlayer == x):
play_x()
$mouse_over.hide()
currentPlayer = o
if(currentPlayer == o):
play_o()
$mouse_over.hide()
currentPlayer = x
My question is probably pretty stupid, but I really have no idea :(
I hope you have a solution for me, because I'm slowly despairing.