|
|
Introduction
How to create your own sprites for game baker 0.1 - This assumes that you have already prepared the frame(s) in an image editor (e.g. the GIMP)
N.B. We plan to have a sprite editor built into game baker, if you would like to help program it, join the developer list and we'll give you a pointer about what interface to use (don't write direct to the plain files as below, there is a nice python interface)
Details
The easiest way to create a new sprite is to create a new text file in the same directory as your game file, called "spritename.gbs". Open this up in a text editor and paste the following:
#!/usr/bin/env python # LEAVE THE FOLLOWING TWO LINES # GAME BAKER SPRITE # yaml # 0 s = """ !!python/object:game.Sprite name: objtype: Sprite alphakey: !!python/tuple [0, 0, 0] framerate: 1 imagefiles: - bottomright: !!python/tuple [60, 42] filename: topleft: !!python/tuple [0, 0] """ if __name__ == "__main__": import gbfileio,sys,runtime game = gbfileio.loadgame(sys.argv[0]) runtime.run_game(game)
(It is very important to leave the comments in there, and to not change the spacing outside of the triple quotes)
The part in triple quotes is in YAML, and is the part you should modify.
- After "name:" enter the name that you would like your sprite to have.
- Set the Alpha-key as an RGB value. This is the colour that will appear transparent. It is currently set to be [0,0,0] (i.e. black)
- The "framerate" (badly named) is the number of game loops before a sprite moves onto the next frame. It is currently 1
- Now Create your frames:
Copy
- bottomright: !!python/tuple [60, 42] filename: topleft: !!python/tuple [0, 0]
once for each frame that you have, and change the three settings as appropriate.
For example:
- bottomright: !!python/tuple [10, 10] filename: images/spritesheet.bmp topleft: !!python/tuple [0, 0] - bottomright: !!python/tuple [20, 10] filename: images/spritesheet.bmp topleft: !!python/tuple [10, 0] } Creates two 10 x 10 px frames from a single sprite sheet, with the sprites starting at [0,0] and [10,0]
Sign in to add a comment
