/
LEVEL-PROPERTIES-DOC
43 lines (34 loc) · 1.53 KB
/
LEVEL-PROPERTIES-DOC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
This document describes the YAML markup nessisary for .lvl files.
This is the version 0.1 spec. The 0.1 spec is implemented in block.rb
Each level (.lvl file) will have an accociated .yml file with the same name. (i.e. level1.lvl with have a level1.yml file)
Each .yml file will be defined as a ruby hash. (example hash will be called "data")
Properties.
1: Health
data[:health][sprite_number] = health
where sprite_number is the index number of the loaded sprite
where health is the number of desired hits it takes to destroy a tile
How to create properties with properties editor:
run the command:
ruby -rubygems properties.rb
Click on the level with the properties you would like to edit
Left click on the property to increase the value, Right click to decrease.
When your done editing the properties for the level, click the save button
You are now done, but you can edit other properties if you wish.
How to create properties via other ruby script/irb:
If you don't like, or can't use the properties editor here's how to write a ruby script:
Opening up irb and doing this:
data = {}
data[:health] = {0 => 2} # Block type zero has a health of 2
Should set you up, all you have to do is fill in the actual properties
This code should save your file:
require 'yaml'
output = File.new 'mylvl.yml', 'w'
output.puts YAML.dump(data)
output.close
Place the outputted file in the directory with you .lvl file, and you're done!
Properties in plain old yaml (example from levels/lvl.yml):
---
:health:
0: 2
1: 2
2: 2