dashcode 1.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashcode
3
- Version: 1.1.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
- global objects
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.objects = {
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,
@@ -43,14 +48,15 @@ class Dashcode:
43
48
  "square": {"SQ":0},
44
49
  "corridor": {"X":1},
45
50
  }
46
-
51
+ self.timeline = {}
47
52
  def setobjects(self, objs:dict):
48
- self.objects = objs
53
+ self.objectids = objs
49
54
 
50
55
  def setparams(self, params:dict):
51
56
  self.params = params
52
57
 
53
58
  def addobject(self, obj: str, params: dict):
59
+ objects = self.objects
54
60
  if len(objects) <= 0:
55
61
  objects.append(
56
62
  f"1,1,2,{str(-10 * 30)},3,{str(-10 * 30)},12,1,13,1")
@@ -62,7 +68,7 @@ class Dashcode:
62
68
  else:
63
69
  extraparams += f",{str(param)},{value}"
64
70
 
65
- oid = self.objects.get(obj, 1)
71
+ oid = self.objectids.get(obj, 1)
66
72
  if oid:
67
73
  objects.append(
68
74
  f"1,{str(oid)},2,{str(params.get('X') * 30 + 15)},3,{str(params.get('Y') * 30 + 15)}{extraparams}")
@@ -80,7 +86,7 @@ class Dashcode:
80
86
 
81
87
  return obj_dict
82
88
  def addprefab(self, obj:str, params:dict, prefab:str):
83
- global objects
89
+ objects = self.objects
84
90
  extraparams = ""
85
91
  for param, value in params.items():
86
92
  if self.params.get(param) is not None:
@@ -89,7 +95,7 @@ class Dashcode:
89
95
  else:
90
96
  extraparams += f",{str(param)},{value}"
91
97
 
92
- oid = self.objects.get(obj, 1)
98
+ oid = self.objectids.get(obj, 1)
93
99
  if prefab:
94
100
  #print("1")
95
101
  fab = self.prefabs.get(prefab)
@@ -129,6 +135,20 @@ class Dashcode:
129
135
  newobjs.append(
130
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}")
131
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)
132
152
  def create_gmd_file(self, level_name, author_name, objects_string):
133
153
  global lvlname
134
154
  lvlname = level_name
@@ -138,6 +158,7 @@ class Dashcode:
138
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>'''
139
159
 
140
160
  def decode_objects(self):
161
+ objects = self.objects
141
162
  global obj_string
142
163
  obj_string = ";".join(objects) + ";"
143
164
  return obj_string
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashcode
3
- Version: 1.1.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
 
@@ -8,7 +8,7 @@ if os.path.exists("README.md"):
8
8
 
9
9
  setup(
10
10
  name="dashcode",
11
- version="1.1.1",
11
+ version="1.2.0",
12
12
  packages=find_packages(),
13
13
  author="IWiterI",
14
14
  description="A library for Geometry Dash level generation using .gmd files",
File without changes
File without changes