BulletML is a language designed to express bullet behaviour in a shoot'em up game (turn left, accelerate, spawn children, etc).
This repository contains a set of tools to manipulate BulletML in OCaml.
It contains:
xml-light
) to an ASTAn interpreter is available. Compile it using make
and run
./_obuild/bulletml_run/bulletml_run.asm examples/\[Original\]_btb_6.xml
(or
any other pattern!).
Left click quits, right click reloads the pattern (if you think this is backwards, this is a great pull request to start contributing).
This particular example also displays the extensible nature of the interpreter:
bulletML has no language of colors, but there is a system of hooks. In that
case, this hook sets the state of bullets to Purple
:
let hooks =
[ "changecolor", fun _ -> Purple ]
And the drawing code uses the state to determine the correct sprite.
let draw_bullet window (bulleto, bulletp) b =
let (pxf, pxy) = b.pos in
let px = int_of_float pxf in
let py = int_of_float pyf in
let src = match b.state with
| Blue -> bulleto
| Purple -> bulletp
in
let dst_rect = Sdlvideo.rect ~x:px ~y:py ~w:0 ~h:0 in
Sdlvideo.blit_surface ~src ~dst:window ~dst_rect ()
You can find it here.
Install OCaml, opam, and
libsdl-image1.2-dev
from your distribution.
Then, you can run opam install ocp-build mparser xml-light sdl
.
Finish the installation by running ocp-build -init
.
make
. Run test suite with make check
. Build JS app with make js
.
Contributors are welcome ! But please don't forget to follow the guidelines.
Feel free to report issues on github.
This can be redistributed under the BSD-2 clause license (see LICENSE).
(but you can totally buy me a beer if you think it's worth it)