How do I use collision detection with a chain of sprites?

Just started using Construct 2? Post your questions here

Post » Sun Mar 15, 2015 8:53 am

@alextro Thank you! What a gift! :D

So you add a layer with "invisible" sensor sprites that keep track of the connection to the start sprite. But as im trying to learn, would you (or anyone else) mind explaining what is... actually happening?
B
9
S
1
Posts: 10
Reputation: 390

Post » Sun Mar 15, 2015 7:37 pm

Oops.. you even don't need 'For each sensor', please disable it.
When initial "Sprite" overlap with a "Tiles", it will trigger the corresponding Tiles to spawn a sensor that checks whether there is any overlapping Tiles within 4 directions at the edge (half width of Tiles). Each Tiles that overlapped by the sensor get the frame into a green color. Then instance variable "flowing" activated thus trigger chain reaction system that spawning another sensors for linked Tiles altogether. When the initial Sprite lost a connection to a Tiles, previous sensors destroyed completely and system reset.

For spawn-wait-destroy part, is an experimental event I came up with when creating puzzle games. Usually puzzle-matching games rely on flood-fill mechanic. Just what newt said we can do it using an array to perform flood-fill. Alternatively we can also using direct overlapping test.

Trust me I'm an expert over this subject :lol:
ImageImageImage
B
84
S
38
G
16
Posts: 640
Reputation: 16,961

Post » Mon Mar 16, 2015 2:23 pm

After looking up loopindex, and realizing that 51 was not an arbitrary number but half the tile/sprite size, I kinda worked it out.
I was reading up on "Khan Academy's Intro to algorithms: Route Finding" (can't post links yet) and I guess that is an example of flood filling..
And I DO trust you, even your gravatar looks like a puzzle of sorts :)

Thanks again for helping me out and explaining whats now happening in my program :D
B
9
S
1
Posts: 10
Reputation: 390

Post » Mon Mar 16, 2015 8:13 pm

You got me then. Here is a good reading for another matching system:
http://gamedevelopment.tutsplus.com/tut ... edev-11759

By the way nice recommendation source you gave me. Thank you for pointing that, since I'm collecting pathfinding articles to build my own astar system.

My sample for basic flood-fill (non diagonal picking):
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
84
S
38
G
16
Posts: 640
Reputation: 16,961

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest