View Single Post
  #1  
Old 01-17-2006, 07:55 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
board update help

I almost have this down,
its purpose: to hit bushes just like a sword does.

Problems:
>the bush does not grow back (online)
>the update of the board overwrites the tiles surrounding the board- such as if the bush is near part of a tree, it may take a chunk of tree out to put the removed-bush tile.

HTML Code:
//#CLIENTSIDE
if (weaponfired)
{
 playersprite=33;
 freezeplayer .2;
 putx=playerx+1.5+vecx(playerdir)*2;
 puty=playery+1.5+vecy(playerdir)*2;

 putx = int(putx/2)*2;
 puty = int(puty/2)*2;
 isbush=0;
 for (i=0; i<2; i++) for (j=0; j<2; j++)
  {
    b = board[putx+i+64*(puty+j)];
    bx = b % 16;
    by = int(b / 16);
   //detect bush tiles
    if ((bx==2&&by==0)||
        (bx==2&&by==1)||
        (bx==3&&by==0)||
        (bx==3&&by==1)){
     isbush = 1;
    }
  }

if (isbush==1)
 {
  board[putx+64*puty] = 5+42*16;
  board[putx+1+64*puty] = 6+42*16;
  board[putx+64*(puty+1)] = 5+43*16;
  board[putx+1+64*(puty+1)] = 6+43*16;
  //put bush removed tiles on the level
  updateboard putx,puty,2,2;
  putleaps 0,putx,puty;
 }

}
Any help with getting the board update tiles to be placed correctly would be great please.
Reply With Quote