Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.