I’m working on a deck building/deck management game in Godot. It’s been going really well so far, but I can’t get around a hurdle: I can’t seem to click the same area (the same card shape) again, after clicking it once before. I’ve checked that there’s a collision shape, that nothing is in front of it, etc. I can’t find any reason why it won’t click the card shape the second time. Has anyone had a problem like this, and how did you solve it?
I believe that one of the problems could be that you set new_card to what it already is ($HandFan/SluglyDeck2/ItemCard1/CardID.text = new_card) before you use it. So if new_card is slugly_02 and you pick up slugly_03, you will still reuse slugly_02 you picked up previously. You don’t actually change it.
There are also many other weird things.
Here, you set game.itemscript to 0 if the card title is slugly03, and the second if can only run of game.itemscript is 0.
You also put the second if-statement inside the first one. Or it is just how it looks after copy pasting it in here. If the second if is inside the first if, it will not run for any of the other cards, since the first check filters them out.
I can’t see anything that has to do with functionality, only appearance. You set the text and title of the card, but that is all.
You reuse the same node for all the cards. All of them are ItemCard1. You just change the text and title. Unless you do that elsewhere in your code?
If i were you I would look at some tutorials on how to make card games. Like different ways to approach various problems, and then pick the ones you feel will suit you. I think it would be more helpful for you the get a good foundation than doing patchwork on what you have here. In the end you will probably save a lot of time you’d otherwise have spent on bug fixing etc.
I’m doing my project a disservice by trying to post it here. There’s too much to try to explain and too much code to share. I’m going to just keep working at it until I figure it out.
If it’s an area then every other control node will be “in front” of it in respect to input processing, even if those controls appear to be “behind” in the scene tree. Physics object always receive input events last, regardless of where they are in the tree. Better to use control nodes instead of areas for capturing input.
I ended up switching to a system where the cards are controls in the game, rather than just sprites with data pasted over them. If that makes sense. Anyway, so I’m redoing the project entirely, but it’s going well! Thank you for your suggestion to look into different ways to make card games.