The Dink Network

Reply to Re: WDE 2 crash

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
July 20th 2024, 09:56 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
//tree edge sprite script
//Robj: "Duck these trees and their depth ques, I'm autoscripting this shit"

void main(void)
{
  //check if current sprite is already clipped - first check clip_bottom
  &save_x = sp_clip_bottom(&current_sprite, -1);
  if (&save_x >= 1)
  {
    if (&save_x <= 200)
    {
      //editor clipped to only show top tree of edge sprite
      //check for custom clipping
      &save_x = sp_que(&current_sprite, -1);
      if (&save_x != 0)
      {
        //no que set - let's set it correctly
        &save_y = sp_pframe(&current_sprite, -1);
        &save_x = sp_y(&current_sprite, -1);
        if (&save_y == 10)
        {
          &save_x -= 113;
        }
        else
        {
          &save_x -= 116;
        }
        sp_que(&current_sprite, &save_x);
      }
    }
    
    //we don't want to mess with the custom clipped sprite, so kill this off here
    kill_this_task();
  }
  
  //Now check clip_top
  &save_x = sp_clip_top(&current_sprite, -1);
  if (&save_x >= 178)
  {
    //editor clipped to only show top tree of edge sprite
    //check for custom clipping
    &save_x = sp_que(&current_sprite, -1);
    if (&save_x != 0)
    {
      //no que set - let's set it correctly
      &save_y = sp_pframe(&current_sprite, -1);
      &save_x = sp_y(&current_sprite, -1);
      if (&save_y == 10)
      {
        &save_x += 92;
      }
      else
      {
        &save_x += 84;
      }
      sp_que(&current_sprite, &save_x);
    }
    
    //we don't want to mess with the custom clipped sprite, so kill this off here
    kill_this_task();
  }
  
  //check if the sprite is placed in a way that the the top tree of the edge sprite is off-screen
  &save_y = sp_y(&current_sprite, -1);
  if (&save_y <= 94)
  {
    //top tree offscreen - skip clone sprite creation
    goto set_main;
  }
  
  
  //get the x and y of current tree edge sprite
  &save_x = sp_x(&current_sprite, -1);
  &save_y = sp_y(&current_sprite, -1);
  
  //create the extra sprite and clip
  &save_x = create_sprite(&save_x, &save_y, 0, 32, 9);
  
  //initiate clipping for sprite
  sp_clip_right(&save_x, 51);
  sp_clip_bottom(&save_x, 377);
  
  //now actually clip it
  sp_clip_bottom(&save_x, 180);
  
  //set proper frame and que of clone sprite
  &save_y = sp_pframe(&current_sprite, -1);
  sp_pframe(&save_x, &save_y);
  if (&save_y == 10)
  {
    &save_y = sp_y(&current_sprite, -1);
    &save_y -= 113;
  }
  else
  {
    &save_y = sp_y(&current_sprite, -1);
    &save_y -= 116;
  }
  sp_que(&save_x, &save_y);
  
  //check if the sprite is placed in a way that the the bottom tree of the edge sprite is off-screen
  &save_y = sp_y(&current_sprite, -1);
  if (&save_y >= 471)
  {
    //bottom tree offscreen - kill off current_sprite, it's no longer needed
    sp_active(&current_sprite, 0);
    kill_this_task();
  }
  
set_main:
  
  //clip current sprite
  sp_clip_right(&current_sprite, 51);
  sp_clip_bottom(&current_sprite, 377);
  sp_clip_top(&current_sprite, 185);
  &save_y = sp_y(&current_sprite, -1);
  &save_x = sp_pframe(&current_sprite, -1);
  if (&save_x == 10)
  {
    &save_y += 92;
  }
  else
  {
    &save_y += 84;
  }
  sp_que(&current_sprite, &save_y);
  
  kill_this_task();
}


I attached that to every forest side tree in Charlie's Legacy and it worked pretty good. You can use it for either facing edge tree sprite.