You could just drop a
PHP Code:
join("spawn_seashells");
NPC in the level and then alter the shovel accordingly.
Or, you could check outwards from the point to a certain radius on the tiles.
PHP Code:
// Archimedean spiral
this.a = 1; // turns the spiral
this.b = 1; // distance between successive turns
this.thetaMax = 2 * pi; // increasing this will make it spiral out farther
this.tileRange = {0x31,0x1A4};
function polarToCartesian(temp.polarCoord) {
return {
temp.polarCoord[0]*cos(temp.polarCoord[1]),
temp.polarCoord[0]*sin(temp.polarCoord[1])
};
}
function onDig(temp.coord) { // no idea how you're doing this, but let's say onDig() get's called with {x,y} of the dig spot
for (temp.theta = 0; temp.theta < this.thetaMax; temp.theta+= pi/16) {
temp.normalizedCoord = polarToCartesian({this.a + this.b*temp.theta, temp.theta});
if (tiles[temp.normalizedCoord[0]+temp.coord[0], temp.normalizedCoord[1]+temp.coord[1]] in this.tileRange) {
this.closeToWater = true;
break;
}
}
if (this.closeToWater) {
//woot
}
}
No idea if this will actually work, but the concept is there.
Probably the first way would be easier.