A parser for I Wanna Maker maps
Project description
pywannamaker
A python package for parsing and serializing I Wanna Maker maps from and back to their XML format.
Usage
Importing the pywm module imports all required submodules.
Opening maps
Several functions load and parse a map.
pywm.parseFiledoes so from a file object or file path.pywm.parseLocalopens a map with the provided name in the actual game maps folder (specified in config.py).pywm.parseStringopens a map from the provided string.
Worth noting is that each of these functions can correctly open any non-param element, meaning you can e.g. store individual objects in files.
Saving
Map.serializereturns the map string.Map.savesaves the map to the provided file path.Map.saveLocalsaves the name in the game maps folder with the provided name
Object structure
Mapproperties: Propertiesobjects: [Object]
Propertiesname: strversion: strtileset: strtileset2: strbg: strspikes: strspikes2: strwidth: strheight: strcolors: strscroll_mode: strmusic: str
Objecttype: intx: inty: intsprite_angle: intparams: dict[str, str]events: [Event]children: [Object]linked: [Object]
Eventevent_index: intparams: dict[str, str]events: [Event]
Examples
m = pywm.Map()
m.saveLocal('empty.map')
Creates a new map and saves it.
m = pywm.parseLocal('input.map')
for o in m.objects:
o.x = float(m.properties.width) - o.x
Mirrors a level horizontally
from pywm import Object, Event, ObjectType, EventType, ActionType
cannon = Object(ObjectType.CANNON, 400, 304)
onmetronome = Event(EventType.ONMETRONOMETICK)
onmetronome.params['frames'] = 25
onmetronome.events.append(Event(ActionType.FIRECANNON))
cannon.events.append(onmetronome)
Creates a new cannon object, and gives it an On metronome -> Fire event.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywannamaker-0.0.2.tar.gz.
File metadata
- Download URL: pywannamaker-0.0.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85dd5ac2f07a29ddf24bc2dcecc7fc5b90bde01428a048f99f101ceabb02cd26
|
|
| MD5 |
7da4fda2ceafd38a961f46b14aa0fba6
|
|
| BLAKE2b-256 |
2fbb7407c219171dac81bf7767d6ebc838c30478bf2223cc03a7977c68f791e9
|
File details
Details for the file pywannamaker-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pywannamaker-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
529acddc8b04aba42c5171838f233fa18eb5ce727e62c9d9f96c4c9b16efcbbd
|
|
| MD5 |
980e8fa9063c6d914a4e66e2bd7b0f27
|
|
| BLAKE2b-256 |
462eb36b0e9f575009a6501183b0bdf94cd21d4f7f95a31e8cb0db3e50b2023f
|