Skip to main content

gddecoder

Lib for work this Geometry Dash levels

Start

from gddecoder import *

levels = LocalLevels()

If you need to work with a save file that is not in the standard path

levels = LocalLevels("path/to/file/CCLocalLevels.dat")

LocalLevels is list of levels, to get the level, use the levels.get_level() method or standard list syntax levels[n].

level1 = levels.get_level(10)
level2 = levels.get_level("first level")
level3 = level[10]

levels[n] don't support levels names, level["first level"].

Change levels

Level is dict. To refer to a key in a level, you can use the name of the key that matches the name of the key in the game's save file, or use the LevelSettings enum.

level["k2"] = "test level"
level[LevelSettings.objects_count] = 800

Some programs

Print names of all levels:

from  gddecoder import *


levels = LocalLevels()

for lvl in levels:
    print(lvl[LevelSettings.name])

Counting the total number of jumps in levels:

from gddecoder import *


levels = LocalLevels()

jumps = 0

for lvl in levels:

    # test because the level may not have jumps
    if LevelSettings.jumps in lvl:
        jumps += lvl[LevelSettings.jumps]

print(jumps)

Editor

Level has method get_editor, it return Editor object.

editor = level.get_editor()

Editor object has attribute blocks and colors. Other properties are stored as in a dictionary. Use EditorSettings enum or game key.

# set 2 player mode
editor[EditorSettings.two_player_mode] = True
# get 20 block in level
blocks = editor.blocks[19]
# get bg Color
color_bg = editor.colors[1000]

Blocks

Blocks are also dictionaries. Use BlockSettings enum.

block = editor.blocks[9]
block[BlockSettings.x] = 30
block[BlockSettings.y] = 15

Add block

editor.blocks.add(Block(
    {
        BlockSettings.id: 1,
        BlockSettings.x: 15,
        BlockSettings.y: 15,
    }
))

Block duplication

editor.blocks.add(Block(
    editor.blocks[9]
))

Set groups

Groups is set.

block = editor.blocks[9]
block[BlockSettings.groups] = Groups([1, 2, 10])
block[BlockSettings.groups].add(14)
block[BlockSettings.groups].pop(10)

Colors

The block stores only the color channel of the block as an int. To change a color, you need to change the corresponding color in editor.colors and then assign it to the block.

Save

Save to standart path:

level.set_editor(editor)
levels.save()

For other path:

level.set_editor(editor)
levels.save("other/path/file.dat")

Metadata

Release files for gddecoder 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gddecoder 1.1.0
File Size Uploaded
gddecoder-1.1.0.tar.gz 11.2 kB Details

Release files / gddecoder-1.1.0.tar.gz

Download URL gddecoder-1.1.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
af83cc4b037ea276e52bd7b75347401ead28e625ffc1faec9c54bbe68c540639
BLAKE2b-256 checksum
How to use checksums
ce593847af7120b17832c55c3382d16d696a7732b8df8c41415502a6d2466055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page