The information in this article is for Terraria v188.8.131.52.
The star class is responsible for handling the twinkling stars at night. There are only a handful of methods and variables you can use, simply because it is a lightweight, simple class. Like the Cloud Class, the star class will be among those that are underused in mods. That said, you can still do a few interesting things with them.
An object containing the location information about this star, including its (X, Y) position. Note that unlike many other position vectors, stars are positioned relative to the screen, rather than to the game world!
The x-coordinate of the star on the screen. Note that this is a member of position.
The y-coordinate of the star on the screen. Note that this is a member of position.
How large or small to scale the sprite. Typical range is 0.5 to 1.2 times larger.
How many degrees the sprite is rotated. Adjusted by rotationSpeed every tick.
What type of star to use. Unlike many other classes, this is only cosmetic, and affects what sprite is drawn. Values here range from 0 to 4.
A counter for simulating a glimmering effect. While the class doesn't reference the value, main does. It simply adjusts the drawn brightness.
The speed in which the star twinkles. I believe that a "twinkle" involves it fading and appearing brighter.
The in which the star rotates. This is how many degrees per tick. Not sure of the default values yet.
This method populates the world with the stars that will cross the sky at night. Interestingly, it is only called if your game client is not on a server. I suspect this is to keep the night sky consistent across different machines on the server.
Returns no value
public static void UpdateStars()
This method is invoked every tick, and it updates every star by changing their rotation amount, twinkle values, etc.