FANDOM


The information in this article is for Terraria v1.0.6.1.

The dust class is responsible for handling all the different particle effects in the game. It is used extensively throughout Terraria, and in particular is useful for making your weapons more interesting. It also makes dust, the little light "crumbs" that fall and light the area up, the clouds that poof into existence for your Cloud in a Bottle, and many, many more.
Chests

Placeholder!

Read More


PropertiesEdit

Name Type Description
active bool Whether the particle is marked for deletion
alpha int The transparency of the particle. Value should be from 0 (invisible) to 255 (opaque)
color Color The color of the particle
fadeIn float
frame Rectangle
noGravity bool Whether the particle is affected by gravity
noLight bool Whether the particle should emit light
position Vector2 The position of the particle in the game world
rotation float
scale float A multiplier that affects how large the particle sprite should be
type int The type of dust used. See List of Dust
velocity Vector2 The velocity of the particle in the game world

Static PropertiesEdit

Name Type Description
lavaBubbles int

MethodsEdit

Method Name Description
GetAlpha()
public static Color GetAlpha(Color newColor)
{
}

Get the alpha blending value of this particle.

  • Returns the alpha as a Color value
GetColor()
public static Color GetColor(Color newColor)
{
}

Gets the color blending of this particle.

  • Returns the color as a Color value
UpdateDust()
public void Update Dust()
{
}

Updates the dust particle by increasing it's speeds, etc.

  • Returns no value

Static MethodsEdit

Method Name Description
NewDust()
public static int NewDust(
    Vector2 Position,
    int Width,
    int Height,
    int Type,
    [float SpeedX = 0f],
    [float SpeedY = 0f],
    [int Alpha = 0],
    [Color newColor = null],
    [float Scale = 1f]
    )
{
}

Creates a new dust particle in the world. See the Notes section below for more information.

NotesEdit

(please update this with better formatting)

See also - List of Dusts

To spawn a new instance of the Dust class you will need to use the static method 'NewDust'. The method takes a number of parameters:

  • Position - Vector2 object for the location of the particle
  • Width - Width, in pixels of the bounding box - an integer
  • Height - Height, in pixels of the bounding box - also an integer
  • Type - Integer type

And some optional parameters:

  • SpeedX - Floating point value for the velocity of the particle in the X direction (horizontal). Default: 0
  • SpeedY - Floating point value for the vertical velocity. Default: 0
  • Alpha - Transparency value - an integer from 0 to 255. Default: 0
  • newColor - Color of the particle. Default: null
  • Scale - Size of the particle as a floating point. Default: 1.0f

Calling 'NewDust' method will return the 'whoAmI' value of the new particle - it's unique identifier.

Unfortunately, a newly generated dust particle is not quite ready to go just yet. From the method we can see that the Alpha defaults to 0 which is completely transparent. If we didn't set it in the method call we need to do so now. Also not set is the speed, but the particle will still work with these values it just won't move (unless noGravity = false). newColor also needs to be set to a VALID color. Attempting to set newColor = null will in most cases cause a crash. If you want to use the color of the texture then simply set newColor to Color.Transparent.

Once these values are set, the particle should work as expected.

Classes in Terraria

Chest | Cloud | Collision | Dust | Gore | Item | Lighting | Liquid | Main | NPC | Player | Projectile | Recipe | Sign | Star | WorldGen

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.