• All, I am currently in the process of migrating domain registrations. During this time there may be some intermittent outages or slowdowns. Please contact staff if you have any questions.

Clipping part of a sprite

bWWd

Well-known member
Hey gus theres literally 2 example sof clipping in drawmethod on forums, anyone managed to get it working? no matter what i set, its simply not clipping anything
lets say i want to clip 100x100 quad starting from character offset and clip to the right side.

REgular drawmethod, nonscript one works fine but the one in script , it just doesnt do anything, is it supposed to be in updatescript ?
This aint working :

@cmd changedrawmethod getlocalvar("self") "clip" 32 1 134 93


but this works


drawmethod clip 32 1 134 93

So this does not work :
Code:
anim    walk
 
        loop    1
    offset    100 249
    bbox 63 14 60 236
            @script
  if(frame >  4 ){
    void self = getlocalvar("self");

            changedrawmethod( self , "cliph", 600);
            changedrawmethod( self , "clipw", 256);
            changedrawmethod( self , "clipx", -100);
            changedrawmethod( self, "clipy", 300);
 
 
 
 settextobj(1, 555 ,555 , 0, -1, "shouldclip !" , openborvariant("elapsed_time")+20);

  }
@end_script
    delay 7

    frame    data/chars/heman/p_w_03.gif
    frame    data/chars/heman/p_w_04.gif



Ok i added

changedrawmethod( getlocalvar("self") , "enabled", 1);

But the same values aint working for scripted one that work for regular inline animation one... so bizarre
 
Last edited:
Hey gus theres literally 2 example sof clipping in drawmethod on forums, anyone managed to get it working? no matter what i set, its simply not clipping anything
lets say i want to clip 100x100 quad starting from character offset and clip to the right side.

REgular drawmethod, nonscript one works fine but the one in script , it just doesnt do anything, is it supposed to be in updatescript ?
This aint working :

@cmd changedrawmethod getlocalvar("self") "clip" 32 1 134 93


but this works


drawmethod clip 32 1 134 93

So this does not work :
Code:
anim    walk
 
        loop    1
    offset    100 249
    bbox 63 14 60 236
            @script
  if(frame >  4 ){
    void self = getlocalvar("self");

            changedrawmethod( self , "cliph", 600);
            changedrawmethod( self , "clipw", 256);
            changedrawmethod( self , "clipx", -100);
            changedrawmethod( self, "clipy", 300);
 
 
 
 settextobj(1, 555 ,555 , 0, -1, "shouldclip !" , openborvariant("elapsed_time")+20);

  }
@end_script
    delay 7

    frame    data/chars/heman/p_w_03.gif
    frame    data/chars/heman/p_w_04.gif



Ok i added

changedrawmethod( getlocalvar("self") , "enabled", 1);

But the same values aint working for scripted one that work for regular inline animation one... so bizarre

You don't need an update script. Drawmethod is persistent once set. Not sure what's going on though. I don't have any trouble with it other than just sometimes getting my offsets messed up.

Can you post a SS of what you're getting and the raw sprite?

DC
 
Well im getting this i i set it to enabled
Code:
@script
 settextobj(1, 555 ,555 , 0, -1, "shouldclip !" , openborvariant("elapsed_time")+20);
      changedrawmethod(  getlocalvar("self") , "enabled", 1);
       changedrawmethod(  getlocalvar("self") , "clip", 32,1,134,93 );
@end_script



1701793734222.png


But when i use regular drawmethod , its all fine with identical values

drawmethod clip 32 1 134 93

1701793981530.png


Sooo... waht the hell is going on ?
 
I'd need to go through the code to make sure, but IIRC, this is a case of script working with the real values (based on the sprite's top corner), and text drawmethod loading sanitized values based on the offset.
 
Back
Top Bottom