Jump to content
  • 0

How to add costum animated sprites for decorations?


Lanie

Question

Dear Doomers,

 

i already know how to add costum sprites as a decorate, e. g. a trashcan (see below). Can you tell me, how to add animated sprites as decorat?

 

 

actor Trash 25511
    {
    //$Category Obstacles
    Radius 32
    Height 64
    +SOLID
    States
    {
    Spawn:
    TRAS A -1
    Stop    
    }
}

Thank you, Lanie.

Edited by Lanie

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0

And if your decoration does not have anything special going on (the examples on the wiki include something that alternates between full-bright and not, and something that calls action functions), you can have all your states on a single line, like this:

actor Trash 25511
{
    //$Category Obstacles
    Radius 32
    Height 64
    +SOLID
    States
    {
    Spawn:
    TRAS ABCDEFGH 5
    Loop    
    }
}

Here the trash can goes through eight frames of animation (A to H), staying for five tics (1/7th of a second) each, so the total animation cycle lasts for about 1.143 seconds, and looping back to the start of the animation when finished.

 

If you do want to do fancy effects on certain frames only, then you will have to separate those frames. Here's another example where the trash can emits a sound on the F frame:

actor Trash 25511
{
    //$Category Obstacles
    Radius 32
    Height 64
    +SOLID
    States
    {
    Spawn:
    TRAS ABCDE 5
    TRAS F 5 A_StartSound("trashcan/noise")
    TRAS GH 5
    Loop    
    }
}

(This example assumes that the sound "trashcan/noise" is defined somewhere in SNDINFO. It's not a vanilla sound so it doesn't exist by default, this is just for example.)

Share this post


Link to post
  • 0
1 hour ago, Gez said:

And if your decoration does not have anything special going on (the examples on the wiki include something that alternates between full-bright and not, and something that calls action functions), you can have all your states on a single line, like this:


actor Trash 25511
{
    //$Category Obstacles
    Radius 32
    Height 64
    +SOLID
    States
    {
    Spawn:
    TRAS ABCDEFGH 5
    Loop    
    }
}

Here the trash can goes through eight frames of animation (A to H), staying for five tics (1/7th of a second) each, so the total animation cycle lasts for about 1.143 seconds, and looping back to the start of the animation when finished.

 

If you do want to do fancy effects on certain frames only, then you will have to separate those frames. Here's another example where the trash can emits a sound on the F frame:


actor Trash 25511
{
    //$Category Obstacles
    Radius 32
    Height 64
    +SOLID
    States
    {
    Spawn:
    TRAS ABCDE 5
    TRAS F 5 A_StartSound("trashcan/noise")
    TRAS GH 5
    Loop    
    }
}

(This example assumes that the sound "trashcan/noise" is defined somewhere in SNDINFO. It's not a vanilla sound so it doesn't exist by default, this is just for example.)

 Thank you for your great answers! I have 2 follow-up questions:

 

1.) Do I put the aditional pictures/frames into the same S/Start // S/END group like the orignal decoration-sprite? (and add them to the patch-table)

2.) and more importantly: Do i need to define this animation also in the ANIMDEF-File or is it enough to code into the decoration-file?

 

 

Share this post


Link to post
  • 0
48 minutes ago, Lanie said:

1.) Do I put the aditional pictures/frames into the same S/Start // S/END group like the orignal decoration-sprite?

Yes.

48 minutes ago, Lanie said:

(and add them to the patch-table)

No. The patch table is there for texture patches, not for sprites. It's only useful to add a sprite to the patch table if you want to put it on a wall texture as well.

 

51 minutes ago, Lanie said:

2.) and more importantly: Do i need to define this animation also in the ANIMDEF-File or is it enough to code into the decoration-file?

Also no. ANIMDEFS is also something that is relevant for textures, not for sprites. Sprites are animated according to their actor's state table, so there's no need to bring in a secondary animation that would work at cross-purpose with the first.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...