Thread: Tile Checking
View Single Post
  #9  
Old 07-22-2008, 07:38 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
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.1// turns the spiral
this.1// distance between successive turns
this.thetaMax 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 0temp.theta this.thetaMaxtemp.theta+= pi/16) {
    
temp.normalizedCoord polarToCartesian({this.this.b*temp.thetatemp.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.

Last edited by WhiteDragon; 07-22-2008 at 08:56 AM..
Reply With Quote