Pick nearest matching value in array

Get help using Construct 2

Post » Wed Sep 30, 2015 10:05 pm

There you go, in the form of a recursive function that check in a circular manner around the provided point. It returns the first found zero scanning from top to bottom and left to right.

https://dl.dropboxusercontent.com/u/700 ... Array.capx

ramones' answer is better, since my method will possibly revisit already checked Array cells if no suitable candidate was found in the first recursion.

edit: Just updated the capx with a travesty of a Breadth-First algorithm. It's surprisingly simple, yet, better than my previous version.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Thu Oct 01, 2015 11:30 pm

Works like a charm! Took me awhile to understand what is going on there, but already implemented it and modified a bit to fit my game needs.
Much appreciated!
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Previous

Return to How do I....?

Who is online

Users browsing this forum: dop2000, TheCrazyPrince and 23 guests