-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
A catalog of common layer/wall setups
Create a new instance of PolyWall and assign it to a variable.
PW = PolyWall:new()The rest of the examples in this page will use the variable
PW.
The code in one example does not necessarily have any relation to the previous example or any other example.
Add a layer with index 0 to the root layer (PW).
PW:add(0)Index layer 0.
PW[0]
-- OR
PW.L[0] -- Not recommendedAdd a layer with index 1 to layer 0 (the one we just created).
PW[0]:add(1)Index layer 0, 1.
PW[0][1]Set root layer speed to 30.
PW.speed:set(30)Set the color of all verticies of layer 0 to red.
PW[2].vertex:chset(255, 0, 0, 255)Set the cartesian transformation of vertex 0 of layer 4.
PW[4].vertex[0].pol:set(function(x, y) return x * 0.5, y * 0.5 end)Get the alpha channel of vertex 2 of layer 2, -1.
PW[2][-1].vertex[2].ch.a:get()Recursively create layers using the template function.
PW:template(0, 2)
PW:template(1, 3)
PW:template(2, 4)This creates 2 layers on the root layer. Then it creates 3 layers on each of those 2 layers for a total of 6 new layers. Then on each of those 6 layers, 4 new layers are created for a total of 24 new layers.
Set up a regular hexagon on the root layer.
PW:template(0, 6)
PW:regularize(0, 6)Set up regular triangles on all sublayers 2 layers down from the root layer with an angle offset of -0.25 radians
PW:template(2, 3)
PW:regularize(2, 3, -0.25)Set up an irregular pentagon on layer 2 with one side's arc length half as long as the others and an angle offset of 0.5 radians.
PW[2]:template(0, 5)
PW[2]:proportionalize(0, 0.5, 2, 2, 2, 2, 1) -- Ratio of 2:2:2:2:1Overriding the default cWall() function will change it's behavior in all patterns that use it. This is desireable if you want to use PolyWalls with normal pattern functions without having to rewrite all of the functions.
Create a new cWall() function at the initialization of a level script to override it's functionality.
Remember to use
t_eval()for non-timeline functions.
function cWall(side)
t_eval([[
PW[%d]:sWall()
]]:format(side % l_getSides()))
endPolyWall has no "sides" system like the previous version. Each "side" is it's own layer that must be indexed to create walls on specific sides.
To prevent indexing out of bounds and restore the cyclic nature of side indicies, use a modulo (
%) with the corresponding correct side count.
The information presented in this wiki is not guaranteed to be accurate. The information presented may be a few versions old.