Reply to Re: WDE 2 crash
If you don't have an account, just leave the password field blank.
//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(¤t_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(¤t_sprite, -1);
if (&save_x != 0)
{
//no que set - let's set it correctly
&save_y = sp_pframe(¤t_sprite, -1);
&save_x = sp_y(¤t_sprite, -1);
if (&save_y == 10)
{
&save_x -= 113;
}
else
{
&save_x -= 116;
}
sp_que(¤t_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(¤t_sprite, -1);
if (&save_x >= 178)
{
//editor clipped to only show top tree of edge sprite
//check for custom clipping
&save_x = sp_que(¤t_sprite, -1);
if (&save_x != 0)
{
//no que set - let's set it correctly
&save_y = sp_pframe(¤t_sprite, -1);
&save_x = sp_y(¤t_sprite, -1);
if (&save_y == 10)
{
&save_x += 92;
}
else
{
&save_x += 84;
}
sp_que(¤t_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(¤t_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(¤t_sprite, -1);
&save_y = sp_y(¤t_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(¤t_sprite, -1);
sp_pframe(&save_x, &save_y);
if (&save_y == 10)
{
&save_y = sp_y(¤t_sprite, -1);
&save_y -= 113;
}
else
{
&save_y = sp_y(¤t_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(¤t_sprite, -1);
if (&save_y >= 471)
{
//bottom tree offscreen - kill off current_sprite, it's no longer needed
sp_active(¤t_sprite, 0);
kill_this_task();
}
set_main:
//clip current sprite
sp_clip_right(¤t_sprite, 51);
sp_clip_bottom(¤t_sprite, 377);
sp_clip_top(¤t_sprite, 185);
&save_y = sp_y(¤t_sprite, -1);
&save_x = sp_pframe(¤t_sprite, -1);
if (&save_x == 10)
{
&save_y += 92;
}
else
{
&save_y += 84;
}
sp_que(¤t_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.






