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
69
S
28
G
24
Posts: 977
Reputation: 18,739

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
157
S
66
G
41
Posts: 2,599
Reputation: 34,825

Previous

Return to How do I....?

Who is online

Users browsing this forum: FacuLNF and 58 guests