Godot Version
4.2.2
Question
Hi everyone,
i’m new here. I started to play with Godot 3 back in 2020/2021, but now i try to develop at least a few full games. Let’s see how that goes.
Well, currently for learning purposes i’m building a Columns clone. Not sure if you know what i mean, it’s a falling puzzle piece type game, where you have to match at least three blocks of the same type upon the block landing. I did this with Area2D nodes (the single blocks of the whole 3-block piece), and when a piece lands, the single blocks are “anchored” to the grid.
So far so good. I’m doing a collision check with signals when a new block is on top of an existing one, and setting a variable “contact” to true or false. And you can still move the piece to the left or right for a bit to avoid having it land on top of other blocks, in case there is a gap to have it fall down further. This also works… my problem then comes when i have no gap, so when moving left and right, i constantly get the signals “area_entered”, “area_exited”, and some times they get mixed up (or there really isn’t an order if you have signals sent at the same point in time).
Contact: false
Area Entered!!!
Contact: true
Area Entered!!!
Area left…
Contact: false
Area left…
Area Entered!!!
Contact: true
Area Entered!!!
Area left…
Contact: false
Area left…
Area Entered!!!
Contact: true
Area Entered!!!
Area left…
Contact: false
So as you see in between, when the active piece is still on top of another, there are phases where my variable “contact” is false, because the next “area entered” came before the “area left”. So the block still drops down into another block, at which point it stops, because i can’t move left or right anymore (because the left/right signals kicking in).
I have the feeling i’ve been looking at this for to long now and can’t see the probably easy solution. Or, as this is the first project i want to finish, i’m still missing possible options in my head on how to solve it.
Does anyone have a smart idea for me how to safely switch the “contact” variable, or maybe another way of detecting or solving this issue?
Currently each block has an area, as well as the puzzle piece itself (which gets deleted upon anchoring the block to the grid). I detect if something is below by the active piece itself sending area_entered and area_exited signals.
Thank you! The game will be put on itch.io when i get it finished, i’m currently working on building kind of a portfolio…