dashcode 1.1.0__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dashcode-1.1.0 → dashcode-1.2.0}/PKG-INFO +8 -1
- {dashcode-1.1.0 → dashcode-1.2.0}/README.md +7 -0
- {dashcode-1.1.0 → dashcode-1.2.0}/dashcode/core.py +68 -14
- {dashcode-1.1.0 → dashcode-1.2.0}/dashcode.egg-info/PKG-INFO +8 -1
- {dashcode-1.1.0 → dashcode-1.2.0}/setup.py +1 -1
- {dashcode-1.1.0 → dashcode-1.2.0}/dashcode/__init__.py +0 -0
- {dashcode-1.1.0 → dashcode-1.2.0}/dashcode.egg-info/SOURCES.txt +0 -0
- {dashcode-1.1.0 → dashcode-1.2.0}/dashcode.egg-info/dependency_links.txt +0 -0
- {dashcode-1.1.0 → dashcode-1.2.0}/dashcode.egg-info/top_level.txt +0 -0
- {dashcode-1.1.0 → dashcode-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dashcode
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A library for Geometry Dash level generation using .gmd files
|
|
5
5
|
Author: IWiterI
|
|
6
6
|
Project-URL: Homepage, https://github.com/ISviterI/dashcode
|
|
@@ -32,6 +32,13 @@ Dashcode is a specialized Python library for the programmatic generation of Geom
|
|
|
32
32
|
* **Verified Mapping**: Includes corrected IDs for critical items like the Checkpoint (2063) and TouchTrigger logic.
|
|
33
33
|
* **Extensible Logic**: Fully customizable object and parameter dictionaries via `setobjects()` and `setparams()`.
|
|
34
34
|
* **Direct GMD Export**: Encode and package your level data into a ready-to-import .gmd file format.
|
|
35
|
+
* **Timelines**: You can make a list of actions and objects like spawn or create to build easier using `build_timeline()`
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
Check the `/examples` directory for advanced usage:
|
|
39
|
+
* `simple_level.py` - Basic object placement.
|
|
40
|
+
* `timeline_demo.py` - Using `build_timeline()` for synced events.
|
|
41
|
+
|
|
35
42
|
|
|
36
43
|
## Installation
|
|
37
44
|
|
|
@@ -9,6 +9,13 @@ Dashcode is a specialized Python library for the programmatic generation of Geom
|
|
|
9
9
|
* **Verified Mapping**: Includes corrected IDs for critical items like the Checkpoint (2063) and TouchTrigger logic.
|
|
10
10
|
* **Extensible Logic**: Fully customizable object and parameter dictionaries via `setobjects()` and `setparams()`.
|
|
11
11
|
* **Direct GMD Export**: Encode and package your level data into a ready-to-import .gmd file format.
|
|
12
|
+
* **Timelines**: You can make a list of actions and objects like spawn or create to build easier using `build_timeline()`
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
Check the `/examples` directory for advanced usage:
|
|
16
|
+
* `simple_level.py` - Basic object placement.
|
|
17
|
+
* `timeline_demo.py` - Using `build_timeline()` for synced events.
|
|
18
|
+
|
|
12
19
|
|
|
13
20
|
## Installation
|
|
14
21
|
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import gzip
|
|
3
|
-
|
|
4
|
-
objects = []
|
|
5
3
|
obj_string = ""
|
|
6
4
|
lvlname = ""
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
6
|
class Dashcode:
|
|
11
7
|
def __init__(self):
|
|
12
|
-
|
|
8
|
+
self.objects = []
|
|
13
9
|
self.params = {
|
|
14
10
|
"NoTouch": 13,
|
|
15
11
|
"Hide": 12,
|
|
@@ -25,13 +21,22 @@ class Dashcode:
|
|
|
25
21
|
"RotateDegrees": 68,
|
|
26
22
|
"Times360": 69,
|
|
27
23
|
"LockRot": 70,
|
|
24
|
+
"Red":7,
|
|
25
|
+
"Green":8,
|
|
26
|
+
"Blue":9,
|
|
27
|
+
"Fade":10,
|
|
28
|
+
"TargetColor":23,
|
|
29
|
+
"Delay": 63,
|
|
30
|
+
"SpawnTrigger":62,
|
|
31
|
+
"MultiTrigger":87
|
|
28
32
|
}
|
|
29
|
-
self.
|
|
33
|
+
self.objectids = {
|
|
30
34
|
"block": 1, "spike": 8, "yorb": 36, "coin": 1329,
|
|
31
35
|
"monster": 918, "bush": 128, "cloud": 129,
|
|
32
36
|
"alpha": 1007, "toggle": 1049, "rotate": 1346,
|
|
33
37
|
"zoom": 1913, "reverse": 1912,
|
|
34
38
|
"checkpoint": 2063,
|
|
39
|
+
"spawn":1268,
|
|
35
40
|
"end": 3600,
|
|
36
41
|
"p_blue": 10, "p_yellow": 11, "p_green": 2926,
|
|
37
42
|
"p_cube": 12, "p_ship": 13, "p_ball": 47, "p_ufo": 111,
|
|
@@ -40,16 +45,18 @@ class Dashcode:
|
|
|
40
45
|
self.prefabs = {
|
|
41
46
|
"wall": {"Y":0},
|
|
42
47
|
"platform": {"X":0},
|
|
43
|
-
"square": {"
|
|
48
|
+
"square": {"SQ":0},
|
|
49
|
+
"corridor": {"X":1},
|
|
44
50
|
}
|
|
45
|
-
|
|
51
|
+
self.timeline = {}
|
|
46
52
|
def setobjects(self, objs:dict):
|
|
47
|
-
self.
|
|
53
|
+
self.objectids = objs
|
|
48
54
|
|
|
49
55
|
def setparams(self, params:dict):
|
|
50
56
|
self.params = params
|
|
51
57
|
|
|
52
58
|
def addobject(self, obj: str, params: dict):
|
|
59
|
+
objects = self.objects
|
|
53
60
|
if len(objects) <= 0:
|
|
54
61
|
objects.append(
|
|
55
62
|
f"1,1,2,{str(-10 * 30)},3,{str(-10 * 30)},12,1,13,1")
|
|
@@ -61,15 +68,25 @@ class Dashcode:
|
|
|
61
68
|
else:
|
|
62
69
|
extraparams += f",{str(param)},{value}"
|
|
63
70
|
|
|
64
|
-
oid = self.
|
|
71
|
+
oid = self.objectids.get(obj, 1)
|
|
65
72
|
if oid:
|
|
66
73
|
objects.append(
|
|
67
74
|
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15)},3,{str(params.get('Y') * 30 + 15)}{extraparams}")
|
|
68
75
|
else:
|
|
69
76
|
objects.append(
|
|
70
77
|
f"1,{str(obj)},2,{str(params.get('X') * 30 + 15)},3,{str(params.get('Y') * 30 + 15)}{extraparams}")
|
|
78
|
+
def parse_object_string(self,objstr):
|
|
79
|
+
data = objstr.split(',')
|
|
71
80
|
|
|
81
|
+
obj_dict = {}
|
|
82
|
+
for i in range(0, len(data) - 1, 2):
|
|
83
|
+
key = data[i]
|
|
84
|
+
value = data[i + 1]
|
|
85
|
+
obj_dict[key] = value
|
|
86
|
+
|
|
87
|
+
return obj_dict
|
|
72
88
|
def addprefab(self, obj:str, params:dict, prefab:str):
|
|
89
|
+
objects = self.objects
|
|
73
90
|
extraparams = ""
|
|
74
91
|
for param, value in params.items():
|
|
75
92
|
if self.params.get(param) is not None:
|
|
@@ -78,24 +95,60 @@ class Dashcode:
|
|
|
78
95
|
else:
|
|
79
96
|
extraparams += f",{str(param)},{value}"
|
|
80
97
|
|
|
81
|
-
oid = self.
|
|
98
|
+
oid = self.objectids.get(obj, 1)
|
|
82
99
|
if prefab:
|
|
83
100
|
#print("1")
|
|
84
101
|
fab = self.prefabs.get(prefab)
|
|
85
102
|
if fab:
|
|
86
103
|
#print(fab)
|
|
87
104
|
#print("2")
|
|
105
|
+
newobjs = []
|
|
88
106
|
if fab.get("X") == 0:
|
|
89
107
|
#print("3")
|
|
90
108
|
for i in range(params.get('EX')):
|
|
91
|
-
|
|
109
|
+
newobjs.append(
|
|
92
110
|
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15 + (i * 30))},3,{str(params.get('Y') * 30 + 15)}{extraparams}")
|
|
93
111
|
if fab.get("Y") == 0:
|
|
94
112
|
#print("3")
|
|
95
113
|
for i in range(params.get('EY')):
|
|
96
|
-
|
|
114
|
+
newobjs.append(
|
|
97
115
|
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15)},3,{str(params.get('Y') * 30 + 15 + (i * 30))}{extraparams}")
|
|
98
|
-
|
|
116
|
+
if fab.get("SQ") == 0:
|
|
117
|
+
for i in range(params.get('EX')):
|
|
118
|
+
newobjs.append(
|
|
119
|
+
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15 + (i * 30))},3,{str(params.get('Y') * 30 + 15)}{extraparams}")
|
|
120
|
+
for v in range(params.get('EY') - 1):
|
|
121
|
+
newobjs.append(
|
|
122
|
+
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15 + (i * 30))},3,{str(params.get('Y') * 30 + 15 + (v * 30) + 30)}{extraparams}")
|
|
123
|
+
if fab.get("X") == 1:
|
|
124
|
+
for i in range(params.get('EX')):
|
|
125
|
+
newobjs.append(
|
|
126
|
+
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15 + (i * 30))},3,{str(params.get('Y') * 30 + 15)}{extraparams}")
|
|
127
|
+
for i in range(params.get('EX')):
|
|
128
|
+
newobjs.append(
|
|
129
|
+
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15 + (i * 30))},3,{str(params.get('Y') * 30 + 15 + params.get("EY") * 30)}{extraparams}")
|
|
130
|
+
if fab.get("Y") == 1:
|
|
131
|
+
for i in range(params.get('EY')):
|
|
132
|
+
newobjs.append(
|
|
133
|
+
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15)},3,{str(params.get('Y') * 30 + 15 + (i * 30))}{extraparams}")
|
|
134
|
+
for i in range(params.get('EY')):
|
|
135
|
+
newobjs.append(
|
|
136
|
+
f"1,{str(oid)},2,{str(params.get('X') * 30 + 15 + params.get("EX") * 30)},3,{str(params.get('Y') * 30 + 15 + (i * 30))}{extraparams}")
|
|
137
|
+
objects += newobjs
|
|
138
|
+
def build_timeline(self, timeline:list):
|
|
139
|
+
cdelay = 0
|
|
140
|
+
for tlobj in timeline:
|
|
141
|
+
i = tlobj.get("Index")
|
|
142
|
+
v = tlobj.get("Value")
|
|
143
|
+
if i == "wait":
|
|
144
|
+
cdelay += v
|
|
145
|
+
elif i == "spawn":
|
|
146
|
+
self.addobject("spawn", {"X":-1, "Y":6, "Delay":str(cdelay),"TGroup":str(v)})
|
|
147
|
+
else:
|
|
148
|
+
params = {"X":-1,"Y":5}
|
|
149
|
+
for i2,v2 in v.items():
|
|
150
|
+
params[i2] = v2
|
|
151
|
+
self.addobject(i,params)
|
|
99
152
|
def create_gmd_file(self, level_name, author_name, objects_string):
|
|
100
153
|
global lvlname
|
|
101
154
|
lvlname = level_name
|
|
@@ -105,6 +158,7 @@ class Dashcode:
|
|
|
105
158
|
return f'''<?xml version="1.0"?><plist version="1.0" gjver="2.0"><dict><k>kCEK</k><i>4</i><k>k2</k><s>{level_name}</s><k>k4</k><s>{b64_objects}</s><k>k5</k><s>{author_name}</s><k>k11</k><i>1091</i><k>k16</k><i>1</i><k>k80</k><i>56</i></dict></plist>'''
|
|
106
159
|
|
|
107
160
|
def decode_objects(self):
|
|
161
|
+
objects = self.objects
|
|
108
162
|
global obj_string
|
|
109
163
|
obj_string = ";".join(objects) + ";"
|
|
110
164
|
return obj_string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dashcode
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A library for Geometry Dash level generation using .gmd files
|
|
5
5
|
Author: IWiterI
|
|
6
6
|
Project-URL: Homepage, https://github.com/ISviterI/dashcode
|
|
@@ -32,6 +32,13 @@ Dashcode is a specialized Python library for the programmatic generation of Geom
|
|
|
32
32
|
* **Verified Mapping**: Includes corrected IDs for critical items like the Checkpoint (2063) and TouchTrigger logic.
|
|
33
33
|
* **Extensible Logic**: Fully customizable object and parameter dictionaries via `setobjects()` and `setparams()`.
|
|
34
34
|
* **Direct GMD Export**: Encode and package your level data into a ready-to-import .gmd file format.
|
|
35
|
+
* **Timelines**: You can make a list of actions and objects like spawn or create to build easier using `build_timeline()`
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
Check the `/examples` directory for advanced usage:
|
|
39
|
+
* `simple_level.py` - Basic object placement.
|
|
40
|
+
* `timeline_demo.py` - Using `build_timeline()` for synced events.
|
|
41
|
+
|
|
35
42
|
|
|
36
43
|
## Installation
|
|
37
44
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|