62a1d0419c696097fb723e58084287194d2056e6
[python-bulletml.git] / bulletml / __init__.py
1 """BulletML parser.
2
3 BulletML is the Bullet Markup Language. BulletML can describe the
4 barrage of bullets in shooting games. (For example Progear, Psyvariar,
5 Gigawing2, G DARIUS, XEVIOUS, ...) This module parses and executes
6 BulletML scripts in Python. All data structures in it are
7 renderer-agnostic.
8
9 In addition to the standard BulletML XML format, this module supports
10 an equivalent YAML format. See bulletml.bulletyaml for more details.
11
12 Finally, three simple collision routines are provided:
13 bulletml.overlaps for stationary circles, bulletml.collides for moving
14 circles, and bulletml.collides_all for one moving circle against many
15 moving circles.
16
17 More information is available at the BulletML homepage,
18 http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html, or the
19 python-bullet homepage, http://code.google.com/p/python-bulletml/.
20
21 Basic Usage:
22
23 from bulletml import Bullet, BulletML
24 doc = Bulletml.BulletML.FromDocument(open("test.xml", "rU"))
25 player = ... # On your own here, but it needs x and y fields.
26 rank = 0.5 # Player difficulty, 0 to 1
27 bullet = Bullet.FromDocument(doc, x, y, target=player, rank=rank)
28 bullets = [bullet]
29 ...
30 for bullet in bullets:
31 bullets.extend(bullet.step())
32 ...
33
34 For drawing, you're on your own, but Bullet instances have a number of
35 attributes that can be used to influence it.
36
37 """
38
39 from bulletml.parser import BulletML
40 from bulletml.impl import Bullet
41 from bulletml.collision import overlaps, collides, collides_all
42
43 VERSION = (2,)
44 VERSION_STRING = ".".join(map(str, VERSION))
45
46 __all__ = ["VERSION", "VERSION_STRING", "Bullet", "BulletML",
47 "overlaps", "collides", "collides_all"]
48