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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#How to build a pipe network:
#1: Add this object. Label it 'pipe'.
#2: Make more than two other objects (like level controllers). Label them 'pipe 0', 'pipe 1', and so on.
#3: -
[object_type]
id=large_pipe_controller
next_animation="'normal'"
always_active=yes
[editor_info]
category=controllers
help="Assign the pipe controller a label. Assign another object a label_of_this_object space sequencial_number."
[var]
name=resolution
type=int
value="10"
[/var]
[/editor_info]
[properties]
bcurve="def(points, percent)
if(size(points)=2,
[(points[0][0]*(100-percent) + points[1][0]*percent)/100.0,
(points[0][1]*(100-percent) + points[1][1]*percent)/100.0],
bcurve(map(range(size(points)-1), 'ind', bcurve(points[ind:ind+2], percent)), percent) #bcurve() this line's output when correct#
)"
level_points="map(sort(filter(level.chars, linked_object=sl) where sl=self.label, a.number < b.number), 'point', [point.midpoint_x, point.midpoint_y])"
[/properties]
on_create="if(level_points, [set(alpha, 0),
map(range(0,resolution), 'point', [
set(rope_ctrl.vars.index, point),
set(rope_ctrl.vars.x_1, rope_ctrl.midpoint_x),
set(rope_ctrl.vars.y_1, rope_ctrl.midpoint_y),
set(rope_ctrl.vars.x_2, bcurve(level_points, ind+100.0/resolution+1)[0]),
set(rope_ctrl.vars.y_2, bcurve(level_points, ind+100.0/resolution+1)[1]),
add_object(rope_ctrl),
] where rope_ctrl = object('pipe_angled_controller', bcurve(level_points, ind)[0], bcurve(level_points, ind)[1], 0) where ind = point * (100.0/resolution) ) where resolution = vars.resolution]
)"
on_end_anim="animation('normal')"
zorder=100
[animation]
id=normal
image=effects/particles.png
x=210
y=104
w=28
h=28
collide="0,0,28,28"
frames=1
duration=1000
[/animation]
[/object_type]
|