X-Git-Url: https://git.yukkurigames.com/?p=python-bulletml.git;a=blobdiff_plain;f=bulletml%2F__init__.py;h=d872be88ed5eb738d2022c182faa220ccc6eed3a;hp=c87a4425b43ac2889828c0695b97ea6a490579a8;hb=HEAD;hpb=29b24c8fc17a3bdcccd1ac853eee5b90c6fd0856 diff --git a/bulletml/__init__.py b/bulletml/__init__.py index c87a442..d872be8 100644 --- a/bulletml/__init__.py +++ b/bulletml/__init__.py @@ -4,28 +4,32 @@ BulletML is the Bullet Markup Language. BulletML can describe the barrage of bullets in shooting games. (For example Progear, Psyvariar, Gigawing2, G DARIUS, XEVIOUS, ...) This module parses and executes BulletML scripts in Python. All data structures in it are -renderer-agnostic. +renderer-agnostic. A sample renderer for Pygame is included. The full +API documentation is contained in its Python docstrings. + +In addition to the standard BulletML XML format, this module supports +an equivalent YAML format. For convenience, two simple collision +routines are provided, bulletml.overlaps for stationary circles and +bulletml.collides for moving circles. More information is available at the BulletML homepage, http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html, or the -python-bullet homepage, http://code.google.com/p/python-bulletml/. +python-bulletml homepage, https://yukkurigames.com/python-bulletml/. -If you want to use a YAML-based implementation, check out the -bulletml.bulletyaml module in this package. Basic Usage: from bulletml import Bullet, BulletML - doc = Bulletml.BulletML.FromDocument(open("test.xml", "rU")) + + doc = BulletML.FromDocument(open("test.xml", "rU")) + player = ... # On your own here, but it needs x and y fields. rank = 0.5 # Player difficulty, 0 to 1 - params = [] # Initial variable settings, usually empty - actions = [a(params, rank) for a in doc.top] - bullet = Bullet(x, y, target=player, actions=actions, rank=rank) + + bullet = Bullet.FromDocument(doc, x, y, target=player, rank=rank) bullets = [bullet] ... for bullet in bullets: - bullets.extend(bullet.step()) - + bullets.extend(bullet.step()) # step() returns new Bullets ... For drawing, you're on your own, but Bullet instances have a number of @@ -35,9 +39,10 @@ attributes that can be used to influence it. from bulletml.parser import BulletML from bulletml.impl import Bullet +from bulletml.collision import overlaps, collides, collides_all -VERSION = (0, 1) +VERSION = (3,) VERSION_STRING = ".".join(map(str, VERSION)) -__all__ = ["VERSION", "VERSION_STRING", "Bullet", "BulletML"] - +__all__ = ["VERSION", "VERSION_STRING", "Bullet", "BulletML", + "overlaps", "collides", "collides_all"]