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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
[object_type]
always_active="yes"
id="retracting_block_sequence"
on_add_block="add_block(0, 0)"
on_add_block_down="add_block(0, 32)"
on_add_block_left="add_block(-32, 0)"
on_add_block_right="add_block(32, 0)"
on_add_block_up="add_block(0, -32)"
on_child_spawned="add(vars.blocks, [child])"
on_create="[set(alpha, 0), set(vars.xpos, midpoint_x), set(vars.ypos, midpoint_y),
fire_event('add_block'),
map(vars.sequence, 'b', if(index%2,
if(b < 0, map(range(abs(b)), fire_event('add_block_up')),
map(range(abs(b)), fire_event('add_block_down'))),
if(b < 0, map(range(abs(b)), fire_event('add_block_left')),
map(range(abs(b)), fire_event('add_block_right'))))),
fire_event('reset')
]"
on_reset="[map(vars.blocks, 'b', set(b.animation, if(index < vars.platform_length, 'extended', 'retracted'))), set(vars.position, 0)]"
on_timer="if(vars.activated and vars.position + vars.platform_length < vars.blocks.size,
[add(vars.position, 1),
set(vars.blocks[vars.position].animation, 'retracting'),
set(vars.blocks[vars.position+vars.platform_length].animation, 'extending')])"
timer_frequency="10"
[vars]
activated="0"
blocks="[]"
platform_length="10"
position="0"
sequence="[20, -10]"
xpos="0"
ypos="0"
[/vars]
[properties]
add_block="def (xmove, ymove) execute(me,
[spawn('retracting_block_sequence.block',
vars.xpos + xmove, vars.ypos + ymove, facing),
add(vars.xpos, xmove),
add(vars.ypos, ymove)
])"
[/properties]
[animation]
duration="200"
frame_info="0,12,0,2,807,389,16,18"
frames="1"
id="normal"
image="compiled-2.png"
rect="807,377,822,408"
[/animation]
[object_type]
has_feet="no"
id="block"
on_change_animation_failure="[animation(previous_animation), schedule(4, animation('extended'))]"
on_end_extending_anim="animation('extended')"
on_end_retracting_anim="animation('retracted')"
solid_area="8,31,7,31"
solid_dimensions="player,common"
zorder="-2"
[animation]
duration="100000"
frames="1"
id="retracted"
image="props/retracting-blocks.png"
rect="64,0,79,31"
[/animation]
[animation]
duration="5"
frames="4"
id="retracting"
image="props/retracting-blocks.png"
rect="0,0,15,31"
solid_area="0,15,15,30"
[/animation]
[animation]
duration="5"
frames="4"
id="extending"
image="props/retracting-blocks.png"
play_backwards="yes"
rect="0,0,15,31"
solid_area="0,15,15,30"
[/animation]
[animation]
duration="100000"
frames="1"
id="extended"
image="props/retracting-blocks.png"
rect="0,0,15,31"
solid_area="0,15,15,30"
[/animation]
[/object_type]
[/object_type]
|