Hey everyone,
I'm fairly new to Construct and am encountering an issue I have been unsuccessful in resolving for several days. I have combed the forums and spent a lot of time testing different solutions, but nothing has worked thus far.
https://www.dropbox.com/s/d5tf8m99ulfmp7c/Untitled_rolling_ball_game_test.capx?dl=0
Game Objective
The goal of the game is for the player to create a path using the available blocks at the bottom to reach the goal (checkered black and white box). When the player drags a block overlapping another block or within LOS (64 pixels) and drops it, the block will pin to that block, allowing the player to construct paths for the ball fairly quickly. I'm using families to control the majority of the logic for the blocks. Using families resolved a lot of the earlier issues I was having (instances of the same object type not pinning together, etc.). However, it has caused a new issue I wasn't encountering when not using families.
The Issue
When a block leaves the UI block and is dropped on the blue tiled background, collisions with the ball should be enabled. When a block is being dragged, collisions with the ball should be disabled. This works for the most part, except when I'm dragging an instance of a block that already exists on the blue tiled background. Collision is disabled for all instances of the object type, not just the block I'm dragging.
Solution Attempts
I'm willing to bet the issue comes from a lack of understanding on how Famiilies function on my part. Here is what I've tried so far to fix the problem:
1.I tried creating a Boolean instance variable on each individual block instead of the family called 'canCollide'. When a block is dropped on the grid, the 'canCollide' Boolean instance variable is turned on. When a block has the 'canCollide' instance variable set to true, collision with the ball is enabled. This didn't seem to make any difference.
2. Stop using families and program each individual block. The issue when I do this is I can no longer pin instances of the same object type to each other, which is critical for the "feel" of the game. Pinning blocks to one another has to be fast.
Any help you all could provide would be hugely appreciated. Please let me know if any additional information is needed. Thank you!