dashcode 1.2.8__tar.gz → 1.3.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.2.8
3
+ Version: 1.3.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
@@ -38,11 +38,10 @@ Dashcode is a specialized Python library for the programmatic generation of Geom
38
38
  * **Timelines**: You can make a list of actions and objects like spawn or create to build easier using `build_timeline()`
39
39
 
40
40
  ## Examples
41
- Check the `/examples` directory for advanced usage:
42
- * `spikes_and_orbs.py` - Basic object placement.
43
- * `prefabs.py` - Placing objects using prefabs
44
- * `timeline_demo.py` - Using `build_timeline()` for synced events.
45
-
41
+ Check the `/examples` in wiki for advanced usage of:
42
+ Object placement
43
+ Prefabs
44
+ Timelines
46
45
 
47
46
  ## Installation
48
47
 
@@ -14,11 +14,10 @@ Dashcode is a specialized Python library for the programmatic generation of Geom
14
14
  * **Timelines**: You can make a list of actions and objects like spawn or create to build easier using `build_timeline()`
15
15
 
16
16
  ## Examples
17
- Check the `/examples` directory for advanced usage:
18
- * `spikes_and_orbs.py` - Basic object placement.
19
- * `prefabs.py` - Placing objects using prefabs
20
- * `timeline_demo.py` - Using `build_timeline()` for synced events.
21
-
17
+ Check the `/examples` in wiki for advanced usage of:
18
+ Object placement
19
+ Prefabs
20
+ Timelines
22
21
 
23
22
  ## Installation
24
23
 
@@ -2,6 +2,7 @@ import base64
2
2
  import gzip
3
3
  from operator import index
4
4
 
5
+ timelineY = 3
5
6
  obj_string = ""
6
7
  lvlname = ""
7
8
 
@@ -60,7 +61,6 @@ class Dashcode:
60
61
  "square": {"SQ":0},
61
62
  "corridor": {"X":1},
62
63
  }
63
- self.timeline = {}
64
64
  def setobjects(self, objs:dict):
65
65
  self.objectids = objs
66
66
  def export_gmd(self, filedata, filename:str="Level"):
@@ -182,20 +182,39 @@ class Dashcode:
182
182
  place(base_x, base_y + i)
183
183
  place(base_x + ex, base_y + i)
184
184
  return placed
185
- def build_timeline(self, timeline:list):
186
- cdelay = 0
187
- for tlobj in timeline:
188
- i = tlobj.get("Index")
189
- v = tlobj.get("Value")
190
- if i == "wait":
191
- cdelay += v
192
- elif i == "spawn":
193
- self.addobject("spawn", {"X":-1, "Y":6, "Delay":str(cdelay),"TGroup":str(v)})
194
- else:
195
- params = {"X":-1,"Y":5}
196
- for i2,v2 in v.items():
197
- params[i2] = v2
198
- self.addobject(i,params)
185
+ def build_timeline(dcself):
186
+ class Timeline:
187
+ def __init__(self):
188
+ self.timeline = []
189
+ self.delay = 0
190
+ self.spawn_trigger_enabled = False
191
+ self.spawn_group = dcself.get_free_group()
192
+ self.x_position = -1
193
+ self.x2_position = -1
194
+ self.spawn_trigger_on_objects = False
195
+ def spawn(self, group:int):
196
+ if self.spawn_trigger_enabled:
197
+ dcself.addobject("spawn", {"X": self.x_position, "Y": 6, "Delay": str(self.delay), "TGroup": str(group),"SpawnTrigger":1,"MultiTrigger":1})
198
+ else:
199
+ dcself.addobject("spawn", {"X": self.x_position, "Y": 6, "Delay": str(self.delay), "TGroup": str(group)})
200
+ self.timeline.append(["spawn",str(group)])
201
+ self.x_position += -1
202
+ def wait(self, seconds:float):
203
+ self.delay += seconds
204
+ self.timeline.append(["wait",str(seconds)])
205
+ def create_object(self, obj:str, params:dict):
206
+ dcself.addobject(obj, params)
207
+ if params.get("X") is None and params.get("Y") is None:
208
+ params["X"] = self.x2_position
209
+ self.x2_position += -1
210
+ params["Y"] = 5
211
+ if self.spawn_trigger_on_objects:
212
+ params["SpawnTrigger"] = 1
213
+ params["MultiTrigger"] = 1
214
+ self.timeline.append([obj, params])
215
+ return Timeline()
216
+
217
+
199
218
  def create_gmd_file(self, level_name, objects_string):
200
219
  global lvlname
201
220
  lvlname = level_name
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashcode
3
- Version: 1.2.8
3
+ Version: 1.3.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
@@ -38,11 +38,10 @@ Dashcode is a specialized Python library for the programmatic generation of Geom
38
38
  * **Timelines**: You can make a list of actions and objects like spawn or create to build easier using `build_timeline()`
39
39
 
40
40
  ## Examples
41
- Check the `/examples` directory for advanced usage:
42
- * `spikes_and_orbs.py` - Basic object placement.
43
- * `prefabs.py` - Placing objects using prefabs
44
- * `timeline_demo.py` - Using `build_timeline()` for synced events.
45
-
41
+ Check the `/examples` in wiki for advanced usage of:
42
+ Object placement
43
+ Prefabs
44
+ Timelines
46
45
 
47
46
  ## Installation
48
47
 
@@ -8,7 +8,7 @@ if os.path.exists("README.md"):
8
8
 
9
9
  setup(
10
10
  name="dashcode",
11
- version="1.2.8",
11
+ version="1.3.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