Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Mewdoom

Zdoom - how to make for loop in decorate ?

Recommended Posts

Hello guys,

I have the idea to create a circle of fire around the player. I think use A_SpawnItemEx like:

A_SpawnItemEx("FireSprite", 64, 0, 0, 0, 0, 0, 0)

and repeat it for all degree angle like

A_SpawnItemEx("FireSprite", 64, 0, 0, 0, 0, 0, 1)
A_SpawnItemEx("FireSprite", 64, 0, 0, 0, 0, 0, 2)
A_SpawnItemEx("FireSprite", 64, 0, 0, 0, 0, 0, 3)
A_SpawnItemEx("FireSprite", 64, 0, 0, 0, 0, 0, 4)
...

there is a way to use a for loop and just increment the last args by 1 until 360 ?

Share this post


Link to post

Yes, it is possible. Here is a working example:

ACTOR Thing
{
    var int user_angle;

    States
    {
    Spawn:
        SOUL A 6 Bright NoDelay A_SpawnItemEx("ArchvileFire", 64, 0, 0, 0, 0, 0, user_angle)
        SOUL A 0 A_SetUserVar("user_angle", user_angle + 10)
        SOUL A 0 A_JumpIf(user_angle < 360, "Spawn")
        Goto Stay

    Stay:
        SOUL A -1 Bright
        Stop
    }
}
See user variables.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×