Updated Introduction to Editor Scripting.md (markdown)
commited
commit
5e375255d4b6a1a561cf0c38b5d8dbc7cb443371
... | ... | @@ -60,17 +60,25 @@ setBlock(1, 0, 1, myBlocks[0]); |
60 | 60 | ``` |
61 | 61 | |
62 | 62 | ## Objects |
63 | ```js |
|
64 | let waterBlock = { |
|
65 | // Pre-define properties |
|
66 | collider: "box", |
|
67 | type: "normal" |
|
68 | }; |
|
69 | 63 | |
70 | // Adding or overriding properties |
|
71 | grassBlock.size = [8, 8, 8]; |
|
72 | grassBlock.collider = "none"; |
|
64 | Objects `{}` works almost similarly to arrays but unlike it is not considered a collection of value but instead a single value composed of other values called "properties" and functions called "methods". Lets take for example a ball, you will ask, how bouncy is this ball? what is its radius? just like this ball an object has its own properties to determine its characteristics. Using it lets try to make a simple structure. |
|
65 | ||
66 | ### Properties |
|
67 | ``` |
|
68 | let justATree = { |
|
69 | position: [0, 0, 0], |
|
70 | components: { |
|
71 | // component: material, size, position |
|
72 | trunk: ["Wood Y", [1, 6, 1] [0, 0, 0]], |
|
73 | leaves: [Foliage, [3, 3, 3], [-1, 4, -1]] |
|
74 | } |
|
75 | } |
|
73 | 76 | ``` |
74 | Objects `{}` works almost similarly to arrays but unlike it is not considered a collection of value but instead a single value composed of other values called "properties" and functions called "methods". Lets take for example a ball, you will ask, how bouncy is this ball? what is its radius? just like this ball an object has its own properties to determine its characteristics. |
|
77 | properties are values that represent chracteristics of an object it can be any value type or a function. As you can see in our example we made the `justATree` object |
|
78 | ||
79 | ### Methods |
|
80 | methods are special properties of an object that can be used as instruction for its behaviors |
|
81 | ||
82 | ## Loops |
|
75 | 83 | |
76 | <!-- ToDo: Loops, Conditions -->
|
|
77 | 84 |
+<!-- ToDo: Conditions --> |