Game API

gd.py implements an interface to interact with saves of Geometry Dash.

Save

Warning

It is recommended to do a backup before working with saves.

Main save/load functionality is contained in SaveUtil, exported and intended to be used as gd.api.save instance.

Example of loading a local database:

import gd
database = gd.api.save.load()

That simple? Yeah, that’s python! Everything is simple.

class gd.api.SaveUtil[source]
await load_async(*args, **kwargs) → gd.api.save.Database[source]

This function is a coroutine.

Asynchronously load a save.

This function is normally used for local GD management. Typical use-case might be, as follows:

database = await gd.api.save.load_async()

Warning

Please note that main_file and levels_file can NOT be None.

Parameters
  • main (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing main part of the save.

  • levels (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing levels part of the save.

  • main_file (Union[str, pathlib.Path]) – Path to a file containing main part of the save. Applied when main is a directory.

  • levels_file (Union[str, pathlib.Path]) – Path to a file containing levels part of the save. Applied when levels is a directory.

Returns

Loaded Database. If any of the files not found, returns an empty gd.api.Database().

Return type

api.Database

load(*args, **kwargs) → gd.api.save.Database[source]

Load a save.

This function is normally used for local GD management. Typical use-case might be, as follows:

database = gd.api.save.load()

Warning

Please note that main_file and levels_file can NOT be None.

Parameters
  • main (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing main part of the save.

  • levels (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing levels part of the save.

  • main_file (Union[str, pathlib.Path]) – Path to a file containing main part of the save. Applied when main is a directory.

  • levels_file (Union[str, pathlib.Path]) – Path to a file containing levels part of the save. Applied when levels is a directory.

Returns

Loaded Database. If any of the files not found, returns an empty gd.api.Database().

Return type

api.Database

await dump_async(*args, **kwargs)None[source]

This function is a coroutine.

Asynchronously dump a save.

This function is normally used for local GD management. Typical use-case might be, as follows:

await gd.api.save.dump_async(database)

Warning

Please note that main_file and levels_file can NOT be None.

Parameters
  • db (api.Database) – Database object to dump.

  • main (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing main part of the save.

  • levels (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing levels part of the save.

  • main_file (Union[str, pathlib.Path]) – Path to a file containing main part of the save. Applied when main is a directory.

  • levels_file (Union[str, pathlib.Path]) – Path to a file containing levels part of the save. Applied when levels is a directory.

dump(*args, **kwargs)None[source]

Dump a save.

This function is normally used for local GD management. Typical use-case might be, as follows:

gd.api.save.dump(database)

Warning

Please note that main_file and levels_file can NOT be None.

Parameters
  • db (api.Database) – Database object to dump.

  • main (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing main part of the save.

  • levels (Optional[Union[str, pathlib.Path]]) – Path to a file/directory containing levels part of the save.

  • main_file (Union[str, pathlib.Path]) – Path to a file containing main part of the save. Applied when main is a directory.

  • levels_file (Union[str, pathlib.Path]) – Path to a file containing levels part of the save. Applied when levels is a directory.

await to_string_async(*args, **kwargs)str[source]

This function is a coroutine.

Asynchronously dump a save into string(s).

This might be used when you need to transfer your save a stream.

Parameters
  • db (api.Database) – Database object to dump.

  • connect (bool) – Whether to join all strings with ; into one string. Default is True.

  • xor (bool) – Whether to apply XOR after zipping the save. (GD does that for local files) Defaults to False.

Returns

A string or a tuple of strings containing the save.

Return type

Union[str, Tuple[str, str]]

to_string(*args, **kwargs)str[source]

Dump a save into strings(s).

This might be used when you need to transfer your save a stream.

Parameters
  • db (api.Database) – Database object to dump.

  • connect (bool) – Whether to join all strings with ; into one string. Default is True.

  • xor (bool) – Whether to apply XOR after zipping the save. (GD does that for local files) Defaults to False.

Returns

A string or a tuple of strings containing the save.

Return type

Union[str, Tuple[str, str]]

await from_string_async(*args, **kwargs) → gd.api.save.Database[source]

This function is a coroutine.

Asynchronoulsy load save from strings.

Parameters
  • main (Union[bytes, str]) – A stream containing main part of the save.

  • levels (Union[bytes, str]) – A stream containing levels part of the save.

  • xor (bool) – Whether to apply XOR 11 to a string. (used in local GD saves) Defautls to False.

Returns

Database object containing loaded data.

Return type

api.Database

from_string(*args, **kwargs) → gd.api.save.Database[source]

Load save from strings.

Parameters
  • main (Union[bytes, str]) – A stream containing main part of the save.

  • levels (Union[bytes, str]) – A stream containing levels part of the save.

  • xor (bool) – Whether to apply XOR 11 to a string. (used in local GD saves) Defautls to False.

Returns

Database object containing loaded data.

Return type

api.Database

make_db(main: str = '', levels: str = '') → gd.api.save.Database[source]

Create a database from string parts.

This method should be used if you already have XML strings, or it can be used as a more understandable way of doing gd.api.Database() creation:

db = gd.api.save.make_db()  # or supply arguments
Parameters
  • main (str) – A string containing main XML part of the save.

  • levels (str) – A string containing levels XML part of the save.

Returns

Database object containing loaded data.

Return type

api.Database

Database

Database is python interface to saves of Geometry Dash.

db = gd.api.make_db()

print(db.load_my_levels())
# LevelCollection[<LevelAPI id=... version=... name=...>, ...]

levels = db.levels
# <Part len=...>

# {"LLM_01": {...}, "LLM_02": ..., ...}

print(levels.get("LLM_02", 0))
class gd.api.Part(stream: str = typing.Union[bytes, str], default: Optional[Dict[str, Any]] = None)[source]
copy() → a shallow copy of D[source]
set(key: Any, value: Any)None[source]

Same as self[key] = value.

dump()str[source]

Dump the part and return an xml string.

class gd.api.Database(main: str = '', levels: str = '')[source]
load_saved_levels() → gd.api.save.LevelCollection[source]

Load “Saved Levels” into api.LevelCollection.

dump_saved_levels(levels: gd.api.save.LevelCollection)None[source]

Dump “Saved Levels” from api.LevelCollection.

load_my_levels() → gd.api.save.LevelCollection[source]

Load “My Levels” into api.LevelCollection.

dump_my_levels(levels: gd.api.save.LevelCollection, *, prefix: str = 'k_')None[source]

Dump “My Levels” from api.LevelCollection.

Level Editing

gd.py provides convenient API for creating and editing levels.

You can create objects like this:

from gd.api import Object

obj = Object(id=1, x=150, y=150, groups={1})
# <Object id=1 x=150 y=150 groups={1}>

string = obj.dump()
# '1,1,2,150,3,150,57,1'

And open editor, like the following:

from gd.api import Editor

# assume we have our 'obj' from above

editor = Editor()

editor.add_objects(obj)

string = editor.dump()
# '<some_data>;1,1,2,150,3,150,57,1;'

There is an option to load the level’s editor:

import gd

client = gd.Client()

level = client.run(client.get_level(30029017))

editor = level.open_editor()

gd.py also gives some helpers in case user does not know some values:

from gd.api import Object

o = Object(x=150, y=150, lock_to_player_x=True, target_group_id=1)
# <Object id=1 x=150 y=150 target_group_id=1 lock_to_player_x=True>

o.set_id('trigger:move')  # move trigger
# <Object id=901 x=150 y=150 target_group_id=1 lock_to_player_x=True>

o.set_easing('sine_in_out')
# <Object id=901 x=150 y=150 easing=Easing.SineInOut (SineInOut) target_group_id=1 lock_to_player_x=True>
gd.api.get_id(x: str, ret_enum: bool = False, delim: str = ':') → Any[source]

Calculate required value from the given directive x.

The format is, as follows: class:name, e.g. special:h. Spaces around : are allowed.

Parameters
  • x (str) – Directive to get value from.

  • ret_enum (bool) – Whether to convert found value to enum. By default, False.

  • delim (str) – Character to split given directive string with. It is not recommended to pass this argument to the function.

Returns

The value found, if any.

Return type

Any

Raises

EditorError – Failed to convert directive to the value.

Editor

class gd.api.Editor(*objects: Sequence[gd.api.struct.Object], **header_args)[source]

Editor interface of gd.py.

Editor can be created either by hand, from decoded level’s data, or taken from a level itself.

set_header(header: gd.api.struct.Header) → gd.api.editor.Editor[source]

Set header of Editor instance to header.

get_header() → gd.api.struct.Header[source]

Get header of Editor instance.

copy_header() → gd.api.struct.Header[source]

Copy header of Editor instance.

get_groups() → Iterable[int][source]

Fetch all used groups in Editor instance and return them as a set.

get_color_ids() → Iterable[int][source]

Fetch all used color IDs in Editor instance and return them as a set.

get_free_group() → Optional[int][source]

Get next free group of Editor instance. None if not found.

get_free_color_id() → Optional[int][source]

Get next free color ID of Editor instance. None if not found.

get_portals() → List[gd.api.struct.Object][source]

Fetch all portals / speed triggers used in this level, sorted by position in level.

get_speed_portals() → List[gd.api.struct.Object][source]

Fetch all speed triggers used in this level, sorted by position in level.

get_x_length() → Union[float, int][source]

Get the X position of a last object. Default is 0.

get_speed() → gd.api.enums.Speed[source]

Get speed from a header, or return normal speed.

get_length(x: Optional[Union[float, int]] = None)float[source]

Calculate length of the level in seconds.

get_color(directive_or_id: Union[int, str]) → Optional[gd.api.struct.ColorChannel][source]

Get color by ID or special directive. None if not found.

get_colors() → gd.api.struct.ColorCollection[source]

Return a reference to colors of the Editor instance.

copy_colors() → gd.api.struct.ColorCollection[source]

Copy colors of the Editor instance.

add_colors(*colors: Sequence[Union[Tuple[int, int, int], int, gd.api.struct.ColorCollection]]) → gd.api.editor.Editor[source]

Add colors to the Editor.

get_objects() → List[gd.api.struct.Object][source]

Return a reference to object of the Editor instance.

add_objects(*objects: Sequence[gd.api.struct.Object]) → gd.api.editor.Editor[source]

Add objects to self.objects.

copy_objects() → List[gd.api.struct.Object][source]

Copy objects of the Editor instance.

map(function: Callable[[gd.api.struct.Object], Any])map[source]

map: Same as calling map on self.objects.

filter(function: Callable[[gd.api.struct.Object], Any])filter[source]

filter: Same as calling filter on self.objects.

dump_to_level(level: gd.level.Level, append_sc: bool = True)None[source]

Dump self to a level object.

dump(append_sc: bool = True)str[source]

Dump all objects and header into a level data string.

copy() → gd.api.editor.Editor[source]

Return a copy of the Editor instance.

Enums

class gd.api.ObjectDataEnum(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing contents of an object.

class gd.api.ColorChannelProperties(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing contents of a color channel.

class gd.api.PlayerColor(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration for player color setting.

class gd.api.CustomParticleGrouping(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration for particle grouping.

class gd.api.CustomParticleProperty1(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration for particle system.

class gd.api.Easing(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing easing of a moving object (used in move/rotate triggers).

class gd.api.PulseMode(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing mode of a pulse trigger.

class gd.api.InstantCountComparison(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing instant count comparison check.

class gd.api.OrbType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing IDs of orb objects.

class gd.api.PadType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing IDs of pad objects.

class gd.api.PortalType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing IDs of portal or speed change objects.

class gd.api.PickupItemMode(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing mode of a pickup trigger.

class gd.api.PulseType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing type of pulse trigger target.

class gd.api.SpecialBlockType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing IDs of special objects (e.g. S, H, etc).

class gd.api.SpecialColorID(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing IDs of special colors (e.g. BG, Line, etc).

class gd.api.TargetPosCoordinates(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing modes for a targetted move trigger.

class gd.api.TouchToggleMode(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing toggle modes of a touch trigger.

class gd.api.TriggerType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing IDs of most triggers.

class gd.api.ZLayer(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing Z Layer of objects.

class gd.api.MiscType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing miscellaneous IDs of objects.

class gd.api.Gamemode(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing different game modes.

class gd.api.LevelType(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration that represents type of the level.

class gd.api.Speed(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing speed modifier modes.

class gd.api.SpeedConstant(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing actual speed modifiers.

class gd.api.SpeedMagic(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration with magic speed constants.

Magic constants are used for translating distance travelled (in units) with certain speed to time taken, like so:

speed = SpeedMagic.FAST.value  # * 2 speed (well, actually just 1.1 lol)

x1 = 0  # beginning of the level
x2 = 1000  # some random coordinate

dx = x2 - x1

t = dx / speed  # ~ 2.58
print(t)
class gd.api.GuidelinesColor(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing guidelines colors.

class gd.api.LevelDataEnum(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing different fields in level data in save.

class gd.api.LevelHeaderEnum(value: Any, names: Union[str, Dict[str, U], List[str], Tuple[str, ]] = (), module: Optional[str] = None, qualname: Optional[str] = None, type: Optional[Type[T]] = None, start: Optional[T] = None, **members: Dict[str, U])[source]

An enumeration representing fields of a level header.

Guidelines

class gd.api.Guidelines[source]
copy() → a shallow copy of D[source]
classmethod new(mapping: Any) → gd.api.guidelines.Guidelines[source]

Create a new Guidelines mapping.

points() → List[Union[float, int]][source]

Get all points with lines on them.

dump(delim: str = '~', pad: int = 1)str[source]

Dump Guidelines object to a string.

LevelAPI

class gd.api.LevelAPI(**properties)[source]
attempts

Property (Attempts).

Type

WIP

binary_version

Property (Binary Version).

Type

WIP

build_tab

Property (Build Tab).

Type

WIP

build_tab_page

Property (Build Tab Page).

Type

WIP

build_tab_pages_dict

Property (Build Tab Pages Dict).

Type

WIP

creator

Property (Creator).

Type

WIP

custom_song

Property (Custom Song).

Type

WIP

description

Property (Description).

Type

WIP

downloads

Property (Downloads).

Type

WIP

editor_layer

Property (Editor Layer).

Type

WIP

extra

Property (Extra).

Type

WIP

first_coin_acquired

Property (First Coin Acquired).

Type

WIP

folder

Property (Folder).

Type

WIP

id

Property (Id).

Type

WIP

info

Property (Info).

Type

WIP

jumps

Property (Jumps).

Type

WIP

kcek

Property (Kcek).

Type

WIP

length

Property (Length).

Type

WIP

level_string

Property (Level String).

Type

WIP

level_type

Property (Level Type).

Type

WIP

likes

Property (Likes).

Type

WIP

name

Property (Name).

Type

WIP

normal_mode_percentage

Property (Normal Mode Percentage).

Type

WIP

objects

Property (Objects).

Type

WIP

official_song

Property (Official Song).

Type

WIP

original

Property (Original).

Type

WIP

password

Property (Password).

Type

WIP

practice_mode_percentage

Property (Practice Mode Percentage).

Type

WIP

requested_stars

Property (Requested Stars).

Type

WIP

revision

Property (Revision).

Type

WIP

second_coin_acquired

Property (Second Coin Acquired).

Type

WIP

seconds_spent_in_editor

Property (Seconds Spent In Editor).

Type

WIP

stars

Property (Stars).

Type

WIP

third_coin_acquired

Property (Third Coin Acquired).

Type

WIP

timely_id

Property (Timely Id).

Type

WIP

unlisted

Property (Unlisted).

Type

WIP

uploaded

Property (Uploaded).

Type

WIP

verified

Property (Verified).

Type

WIP

version

Property (Version).

Type

WIP

x

Property (X).

Type

WIP

y

Property (Y).

Type

WIP

zoom

Property (Zoom).

Type

WIP

HSV

class gd.api.HSV(h: int = 0, s: float = 1, v: float = 1, s_checked: bool = False, v_checked: bool = False)[source]

A class that represents HSV - Hue, Saturation, Value (Brightness) options.

Below is a table that shows how S and V depend on whether they are checked:

value range

false

true

s range

[0, 2]

[-1, 1]

v range

[0, 2]

[-1, 1]

Parameters
  • h (int) – Hue integer value in range [-180, 180].

  • s (float) – Saturation float value in range [0, 2] or [-1, 1] depending on s_checked.

  • v (float) – Value (Brightness) float value in range [0, 2] or [-1, 1] depending on v_checked.

  • s_checked (bool) – Whether s is checked.

  • v_checked (bool) – Whether v is checked.

as_tuple() → Tuple[int, float, float][source]

Return an (h, s, v) tuple.

ColorChannel

class gd.api.ColorChannel(special_directive: str = None, **properties)[source]
set_id(directive: str) → gd.api.struct.ColorChannel[source]

Set ColorID of self according to the directive, e.g. BG or color:bg.

set_color(color: Any) → gd.api.struct.ColorChannel[source]

Set rgb of self to color.

get_color() → gd.colors.Color[source]

Attempt to get color of self.

b

Property (Blue).

Type

int

blending

Property (Blending).

Type

bool

blue

Property (Blue).

Type

int

copied_color_id

Property (Copied Color Id).

Type

int

copy_opacity

Property (Copy Opacity).

Type

bool

g

Property (Green).

Type

int

green

Property (Green).

Type

int

hsv

Property (Hsv Values).

Type

HSV

hsv_values

Property (Hsv Values).

Type

HSV

id

Property (Id).

Type

int

opacity

Property (Opacity).

Type

float

player_color

Property (Player Color).

Type

PlayerColor

r

Property (Red).

Type

int

red

Property (Red).

Type

int

Object

class gd.api.Object(**properties)[source]
set_id(directive: str) → gd.api.struct.Object[source]

Set id of self according to the directive, e.g. trigger:move.

set_z_layer(directive: str) → gd.api.struct.Object[source]

Set z_layer of self according to the directive, e.g. layer:t1 or b3.

set_easing(directive: str) → gd.api.struct.Object[source]

Set easing of self according to the directive, e.g. sine_in_out.

set_color(color: Any) → gd.api.struct.Object[source]

Set rgb of self to color.

get_color() → gd.colors.Color[source]

Attempt to get color of self.

add_groups(*groups: Iterable[int]) → gd.api.struct.Object[source]

Add groups to self.groups.

get_pos() → Tuple[Union[float, int], Union[float, int]][source]

Tuple[Union[float, int], Union[float, int]]: x and y coordinates of self.

set_pos(x: Union[float, int], y: Union[float, int]) → gd.api.struct.Object[source]

Set x and y position of self to given values.

move(x: Union[float, int] = 0, y: Union[float, int] = 0) → gd.api.struct.Object[source]

Add x and y to coordinates of self.

rotate(deg: Union[float, int] = 0) → gd.api.struct.Object[source]

Add deg to rotation of self.

is_checked()[source]

bool: indicates if self.portal_checked is true.

accel_rad

Property (Accel Rad).

Type

str

accel_rad_adjustment

Property (Accel Rad Adjustment).

Type

str

accel_tan

Property (Accel Tan).

Type

str

accel_tan_adjustment

Property (Accel Tan Adjustment).

Type

str

activate_group

Property (Activate Group).

Type

bool

addictive

Property (Addictive).

Type

str

angle

Property (Angle).

Type

str

angle_adjustment

Property (No Effects).

Type

str

animation_id

Property (Animation Id).

Type

int

animation_speed

Property (Animation Speed).

Type

float

b

Property (Blue).

Type

int

blending

Property (Blending).

Type

bool

block_a_id

Property (Item Id).

Type

int

block_b_id

Property (Block B Id).

Type

int

block_id

Property (Item Id).

Type

int

blue

Property (Blue).

Type

int

chance

Property (Chance).

Type

str

chance_lot_groups

Property (Chance Lot Groups).

Type

str

chance_lots

Property (Chance Lots).

Type

str

color_1

Property (Color 1).

Type

int

color_1_hsv

Property (Color 1 Hsv Values).

Type

HSV

color_1_hsv_enabled

Property (Color 1 Hsv Enabled).

Type

bool

color_1_hsv_values

Property (Color 1 Hsv Values).

Type

HSV

color_2

Property (Color 2).

Type

int

color_2_hsv

Property (Color 2 Hsv Values).

Type

HSV

color_2_hsv_enabled

Property (Color 2 Hsv Enabled).

Type

bool

color_2_hsv_values

Property (Color 2 Hsv Values).

Type

HSV

comparison

Property (Comparison).

Type

InstantCountComparison

copied_color_hsv_values

Property (Copied Color Hsv Values).

Type

HSV

copied_color_id

Property (Copied Color Id).

Type

int

copy_color_hsv

Property (Copied Color Hsv Values).

Type

HSV

copy_color_id

Property (Copied Color Id).

Type

int

copy_opacity

Property (Copy Opacity).

Type

bool

count

Property (Count).

Type

int

custom_particle_duration

Property (Custom Particle Duration).

Type

str

custom_particle_fade_in

Property (Custom Particle Fade In).

Type

str

custom_particle_fade_out_adjustment

Property (Custom Particle Fade Out Adjustment).

Type

str

custom_particle_speed

Property (Switch Player Direction).

Type

str

custom_rotation_speed

Property (Custom Rotation Speed).

Type

float

degrees

Property (Degrees).

Type

float

detail_only

Property (Detail Only).

Type

bool

disable_rotation

Property (Disable Rotation).

Type

bool

do_not_enter

Property (Do Not Enter).

Type

bool

do_not_fade

Property (Do Not Fade).

Type

bool

dual_mode

Property (Dual Mode).

Type

bool

duration

Property (Duration).

Type

float

dynamic_block

Property (Dynamic Block).

Type

bool

dynamic_rotation

Property (Dynamic Rotation).

Type

str

easing

Property (Easing).

Type

Easing

easing_rate

Property (Easing Rate).

Type

float

editor_disable

Property (Editor Disable).

Type

bool

editor_layer_1

Property (Editor Layer 1).

Type

int

editor_layer_2

Property (Editor Layer 2).

Type

int

emission

Property (Emission).

Type

str

end_a

Property (End A).

Type

str

end_a_adjustment

Property (End A Adjustment).

Type

str

end_b

Property (End B).

Type

str

end_b_adjustment

Property (End B Adjustment).

Type

str

end_g

Property (End G).

Type

str

end_g_adjustment

Property (End G Adjustment).

Type

str

end_r

Property (End R).

Type

str

end_r_adjustement

Property (End R Adjustement).

Type

str

end_size

Property (End Size).

Type

str

end_size_adjustment

Property (End Size Adjustment).

Type

str

end_spin

Property (End Spin).

Type

str

end_spin_adjustment

Property (End Spin Adjustment).

Type

str

exclusive

Property (Exclusive).

Type

bool

exit_static

Property (Exit Static).

Type

str

fade_in_adjustment

Property (Fade In Adjustment).

Type

str

fade_in_time

Property (Fade In Time).

Type

float

fade_out_adjustment

Property (Set To Player Color 1).

Type

bool

fade_out_time

Property (Fade Out Time).

Type

float

follow_delay

Property (Follow Delay).

Type

float

follow_target_pos_center_id

Property (Follow Target Pos Center Id).

Type

int

g

Property (Green).

Type

int

glow_disabled

Property (Glow Disabled).

Type

bool

gravity_x

Property (Gravity X).

Type

str

gravity_y

Property (Gravity Y).

Type

str

green

Property (Green).

Type

int

group_parent

Property (Group Parent).

Type

bool

grouping

Property (Linked Group).

Type

int

groups

Property (Groups).

Type

set

h_flip

Property (H Flipped).

Type

bool

h_flipped

Property (H Flipped).

Type

bool

high_detail

Property (High Detail).

Type

bool

hold_mode

Property (Hold Mode).

Type

bool

hold_time

Property (Hold Time).

Type

float

ice_block

Property (Ice Block).

Type

str

id

Property (Id).

Type

int

interval

Property (Interval).

Type

float

is_active_trigger

Property (Is Active Trigger).

Type

bool

is_start_rotation_dir

Property (Is Start Rotation Dir).

Type

str

item_id

Property (Item Id).

Type

int

lifetime

Property (Lifetime).

Type

str

lifetime_adjustment

Property (Lifetime Adjustment).

Type

str

linked_group

Property (Linked Group).

Type

int

lock_object_rotation

Property (Lock Object Rotation).

Type

bool

lock_object_scale

Property (Lock Object Scale).

Type

str

lock_to_camera_x

Property (Lock To Camera X).

Type

str

lock_to_camera_y

Property (Lock To Camera Y).

Type

str

lock_to_player_x

Property (Lock To Player X).

Type

bool

lock_to_player_y

Property (Lock To Player Y).

Type

bool

lock_y

Property (Lock To Player Y).

Type

bool

main_only

Property (Main Only).

Type

bool

max_particles

Property (Exit Static).

Type

str

max_speed

Property (Max Speed).

Type

float

move_x

Property (Move X).

Type

float

move_y

Property (Move Y).

Type

float

multi_activate

Property (Multi Activate).

Type

bool

multi_trigger

Property (Multi Trigger).

Type

bool

no_effects

Property (No Effects).

Type

str

non_stick

Property (Non Stick).

Type

str

offset_y

Property (Offset Y).

Type

float

only_move_scale

Property (Only Move Scale).

Type

str

opacity

Property (Opacity).

Type

float

pickup_mode

Property (Pickup Mode).

Type

PickupItemMode

portal_checked

Property (Portal Checked).

Type

bool

pos_var_x

Property (Pos Var X).

Type

str

pos_var_y

Property (Pos Var Y).

Type

str

property_1

Property (Zoom).

Type

str

pulse_mode

Property (Pulse Mode).

Type

PulseMode

pulse_type

Property (Pulse Type).

Type

PulseType

r

Property (Red).

Type

int

randomize_start

Property (Randomize Start).

Type

bool

red

Property (Red).

Type

int

reversed

Property (Reversed).

Type

str

rotation

Property (Rotation).

Type

float

scale

Property (Scale).

Type

float

scale_x

Property (Scale X).

Type

str

scale_y

Property (Scale Y).

Type

str

secret_coin_id

Property (Secret Coin Id).

Type

int

set_pcol1

Property (Set To Player Color 1).

Type

bool

set_pcol2

Property (Set To Player Color 2).

Type

bool

set_to_player_color_1

Property (Set To Player Color 1).

Type

bool

set_to_player_color_2

Property (Set To Player Color 2).

Type

bool

spawn_duration

Property (Spawn Duration).

Type

float

spawn_triggered

Property (Spawn Triggered).

Type

bool

speed

Property (Speed).

Type

float

speed_adjustment

Property (Reversed).

Type

str

start_a

Property (Start A).

Type

str

start_a_adjustment

Property (Start A Adjustment).

Type

str

start_b

Property (Start B).

Type

str

start_b_adjustment

Property (Start B Adjustment).

Type

str

start_g

Property (Start G).

Type

str

start_g_adjustment

Property (Start G Adjustment).

Type

str

start_r

Property (Start R).

Type

str

start_r_adjustment

Property (Start R Adjustment).

Type

str

start_radius_equals_end

Property (Start Radius Equals End).

Type

str

start_size

Property (Start Size).

Type

str

start_size_adjustment

Property (Start Size Adjustment).

Type

str

start_size_equals_end

Property (Start Size Equals End).

Type

str

start_spin

Property (Start Spin).

Type

str

start_spin_adjustment

Property (Start Spin Adjustment).

Type

str

start_spin_equals_end

Property (Start Spin Equals End).

Type

str

strength

Property (Strength).

Type

float

subtract_count

Property (Subtract Count).

Type

bool

switch_player_direction

Property (Switch Player Direction).

Type

str

target_color

Property (Target Color Id).

Type

int

target_color_id

Property (Target Color Id).

Type

int

target_group

Property (Target Group Id).

Type

int

target_group_id

Property (Target Group Id).

Type

int

target_pos_coordinates

Property (Target Pos Coordinates).

Type

TargetPosCoordinates

text

Property (Text).

Type

str

texture

Property (Texture).

Type

str

times_360

Property (Times 360).

Type

float

tint_ground

Property (Tint Ground).

Type

bool

toggle_mode

Property (Toggle Mode).

Type

TouchToggleMode

touch_triggered

Property (Touch Triggered).

Type

bool

tp_portal_distance

Property (Tp Portal Distance).

Type

float

transform_scale_center_x

Property (Transform Scale Center X).

Type

str

transform_scale_center_y

Property (Transform Scale Center Y).

Type

str

transform_scale_x

Property (Transform Scale X).

Type

str

transform_scale_y

Property (Transform Scale Y).

Type

str

trigger_on_exit

Property (Trigger On Exit).

Type

bool

uniform_object_color

Property (Uniform Object Color).

Type

str

unreadable_property_1

Property (Unreadable Property 1).

Type

str

unreadable_property_2

Property (Unreadable Property 2).

Type

str

unstuckable

Property (Unstuckable).

Type

str

use_object_color

Property (Use Object Color).

Type

str

use_target_enabled

Property (Use Target Enabled).

Type

bool

v_flip

Property (V Flipped).

Type

bool

v_flipped

Property (V Flipped).

Type

bool

x

Property (X).

Type

float

x_mod

Property (X Mod).

Type

float

y

Property (Y).

Type

float

y_mod

Property (Y Mod).

Type

float

z_layer

Property (Z Layer).

Type

ZLayer

z_order

Property (Z Order).

Type

int

zoom

Property (Zoom).

Type

str