Body

class games.stardash.body.Body

Bases: games.stardash.game_object.GameObject

The class representing the Body in the Stardash game.

A celestial body located within the game.

property amount

The amount of material the object has, or energy if it is a planet.

Type

int

property body_type

The type of celestial body it is. Either ‘planet’, ‘asteroid’, or ‘sun’.

Type

‘planet’, ‘asteroid’, or ‘sun’

property game_object_name

String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

Type

str

property id

A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

Type

str

log(message: str) → None

Adds a message to this GameObject’s logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

Parameters

message (str) – A string to add to this GameObject’s log. Intended for debugging.

property logs

Any strings logged will be stored here. Intended for debugging.

Type

list[str]

property material_type

The type of material the celestial body has. Either ‘none’, ‘genarium’, ‘rarium’, ‘legendarium’, or ‘mythicite’.

Type

‘none’, ‘genarium’, ‘rarium’, ‘legendarium’, or ‘mythicite’

next_x(num: int) → int

The x value of this body a number of turns from now. (0-how many you want).

Parameters

num (int) – The number of turns in the future you wish to check.

Returns

The x position of the body the input number of turns in the future.

Return type

int

next_y(num: int) → int

The x value of this body a number of turns from now. (0-how many you want).

Parameters

num (int) – The number of turns in the future you wish to check.

Returns

The x position of the body the input number of turns in the future.

Return type

int

property owner

The Player that owns and can control this Body.

Type

games.stardash.player.Player or None

property radius

The radius of the circle that this body takes up.

Type

float

spawn(x: float, y: float, title: str) → bool

Spawn a unit on some value of this celestial body.

Parameters
  • x (float) – The x value of the spawned unit.

  • y (float) – The y value of the spawned unit.

  • title (str) – The job title of the unit being spawned.

Returns

True if successfully taken, False otherwise.

Return type

bool

property x

The x value this celestial body is on.

Type

float

property y

The y value this celestial body is on.

Type

float