-
Notifications
You must be signed in to change notification settings - Fork 0
Using the Block API
The Block-API is a simple way to create new types of blocks. It uses blocks.py.
###General structure
All new blocks are defined in blocks.py in the function new_blocks. Every block is defined in a function that has the same name as the block (for example: wool()). Inside the function are defined several parameters that the main program needs. Every new block which appears in the game is listed in the all_new_blocks-list. This is an easy way to activate or deactivate new blocks.
###Adding a new block
At first, you need an isometric image of the block. It should be a .png image with the size of 44x44 pixels. You'll also need an image that can be used for the item. It should be 22x22 pixels. Then create a new function, that has the same name as your block, inside new_blocks(). After that, create two dictionarys inside your new function called ba and da. Both ba and da should contain only one key and one value. The key is the name of your new block (string) and the action that will be executed when the block is built (ba) or destroyed (da) as a string. Then define image_name and item_name with the paths to the two images mentioned above and return all this. Extend all_new_blocks by the name of your function and you are finished.