Jump to content
  • Advertisement
Sign in to follow this  
mickeyren

checking for hanging objects in Snood

This topic is 2185 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

so i figured out a way to calculate the connected colors from some folks who help me from my other thread - http://www.gamedev.n...used-for-snood/ ie, checking the sides on a jagged array.

now the next difficult part is checking if the objects should fall - so on this screenshot http://d.pr/i/uxhg color index 40 and all other colors beneath it should fall because its not hanging to anything anymore.

the game's data is represented with an array, and those numbers are their index numbers.

from this array arrangement:


A B C
D E F
G H I



If E is what we're checking for - then i will only check for existing objects in B, C, D and F.

Unfortunately its not that easy. in my screenshot, I will discover 40 and 58 will have no more connection but all the rest will fail since they have connection from their sides - both 75 and 76 is connected to each other from their sides. Edited by mickeyren

Share this post


Link to post
Share on other sites
Advertisement
Starting from known "rooted" cells (all cells in the first row), mark the cell and its neighbors as being "rooted". Repeat the process for each neighbor until all neighbors have been visited. Any cells left unmarked are floating. Traverse a cell in each floating island (by marking each cell) and its neighbors to determine which group of cells a floating cell belongs to. Edited by fastcall22

Share this post


Link to post
Share on other sites

Traverse a cell in each floating island (by marking each cell) and its neighbors to determine which group of cells a floating cell belongs to.


Thanks for your thoughts! Didn't though of it that way. But this last line im not sure what the goal is?

Share this post


Link to post
Share on other sites
But this last line im not sure what the goal is?

It isn't necessary, but in case removal of cells results in more than one "floating island", then grouping those cells into "islands" may be useful for animation or scoring.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!