#you would tell them to update their
1 messages ยท Page 1 of 1 (latest)
apologies if i'm not understanding, but update them with what? if i've told them to consider themselves part of the same pipe previously (bc they're connected), then wouldn't they still believe they're part of the same pipe after the fact unless i did some sort of re-evaluation of the tilemap to see which tiles are still connected to which intake tiles?
If you have one fullpipe and draw another one on top of it touching one segment, that segment would tell the other tiles, update yourself and check for neighbours. And iterating from their through all neighbours that are attached will generate the new full pipe. If you take away one tile then, it tells the nighbours again, update yourself and all tiles will check for neighbours again to create new smaller pipes
ok. that is sort of the strategy that i was going with, but just to be clear, are you suggesting i put each full pipe on a different tilemap? hmmm that's interesting. i already do have 3 tilemaps in use (water, ground, and now pipes) so i can't see why not. or am i misunderstanding again? XD
when you say paint on top..
Not literally ๐ just same depth but they intersect visually
ah so adjacent, i gotcha
So like drawing a cross
on a pseudocode level, it would be like looking for neighbors of X pipe connecting piece, adding that to a list of tiles to look at after the loop, and basically just going through that list and doing the same thing?
making a list of total connected pipes and saving it to a class file or something associated with the intake valve
If you have a grid you can just store each nighbours, add them up until none present and then finish pipe merging
sounds like a plan. thank you so much for the time. i just wanted to bounce this off someone who knows more than me (i'm pretty new to all this) before i spent like 2 weeks in the weeds lol
Its not wasted time. Even if the code is not perfect you learn while writing and trying out ๐
And yw ๐
very very true. that's really the point of this project anyway. idk even know if i need pipes for the gameplay lol. thanks again ๐
i'm gonna leave the thread open so i can reference it, but i'm gonna take a break. cheers!
Happy coding ๐ im off to bed ๐
good night
just so you know i totally figured it out ๐ got my full pipes in a dict at least and are working as expected. if a pipe tile changes i can just rescan the whole map and it's not a big performance hit! thanks so much again for your time it really helped! i ended up using a method that basically uses a list as a perameter but then creates a list within it of neighbor tiles and feeds it back into itself if it's > 0. pretty simple little thing once it's all done. lol