Star Class
Comments0this wiki
| The information in this article is for Terraria v1.0.6.1. |
|
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. | ||||
|
|
Properties
Edit
| Name | Type | Description |
|---|---|---|
| position | Vector2 | 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! |
| position.X | float | The x-coordinate of the star on the screen. Note that this is a member of position. |
| position.Y | float | The y-coordinate of the star on the screen. Note that this is a member of position. |
| scale | float | How large or small to scale the sprite. Typical range is 0.5 to 1.2 times larger. |
| rotation | float | How many degrees the sprite is rotated. Adjusted by rotationSpeed every tick. |
| type | int | 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. |
| twinkle | float | A counter for simulating a glimmering effect. While the class doesn't reference the value, main does. It simply adjusts the drawn brightness. |
| twinkleSpeed | float | The speed in which the star twinkles. I believe that a "twinkle" involves it fading and appearing brighter. |
| rotationSpeed | float | The in which the star rotates. This is how many degrees per tick. Not sure of the default values yet. |
Static Properties
Edit
| Name | Type | Description |
|---|---|---|
| None | N/A | N/A |
Methods
Edit
| Method Name | Description |
|---|---|
| None | N/A |
Static Methods
Edit
| Method Name | Description |
|---|---|
| SpawnStars() |
public static void SpawnStars()
{
}
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.
|
| UpdateStars() |
public static void UpdateStars()
{
}
This method is invoked every tick, and it updates every star by changing their rotation amount, twinkle values, etc.
|
Notes
Edit
None yet
| Classes in Terraria |
|---|
|
Chest | Cloud | Collision | Dust | Gore | Item | Lighting | Liquid | Main | NPC | Player | Projectile | Recipe | Sign | Star | WorldGen |

Added by