{ id: "wheel_big_wooden", zorder: -5, properties: { left_rope: "vars.ropes[0]", right_rope: "vars.ropes[1]", }, vars: { other_wheel_position: null, ropes: [], platforms: [], rope_len: 0, nplatforms: 0, cycle_period: 0, }, consts: { PLATFORM_X_DISTANCE: 72, PLATFORM_Y_ADJUST: 30, PLATFORM_SPEED: 2, }, on_process: "[ #we set the positions of all our platforms in here. Icky math ahead!# map(vars.platforms, 'platform', #if the platform is going vertically up the left side# if(cycle_pos > 180 and cycle_pos < 180 + context.vars.rope_len/PLATFORM_SPEED, [set(platform.midpoint_x, context.midpoint_x - PLATFORM_X_DISTANCE), set(platform.midpoint_y, PLATFORM_Y_ADJUST + context.midpoint_y - (cycle_pos - 180)*PLATFORM_SPEED)], #if the platform is going vertically down the right side# if(cycle_pos > 360 + context.vars.rope_len/PLATFORM_SPEED, [set(platform.midpoint_x, context.midpoint_x + PLATFORM_X_DISTANCE), set(platform.midpoint_y, PLATFORM_Y_ADJUST + context.vars.other_wheel_position + (cycle_pos - (360 + context.vars.rope_len/PLATFORM_SPEED))*PLATFORM_SPEED)], #if the platform is curving around the platform. This is basically a circle once you subtract the time spent on the edges# [set(platform.midpoint_x, context.midpoint_x + (wave((if(cycle_pos <= 180, cycle_pos, cycle_pos - context.vars.rope_len/PLATFORM_SPEED)*1000)/360 + 250)*PLATFORM_X_DISTANCE)/1000), set(platform.midpoint_y, PLATFORM_Y_ADJUST + context.midpoint_y + (wave((if(cycle_pos <= 180, cycle_pos, cycle_pos - context.vars.rope_len/PLATFORM_SPEED)*1000)/360)*PLATFORM_X_DISTANCE)/1000 - if(cycle_pos > 180, context.vars.rope_len, 0))] )) #a variable representing where this platform is in its repeating cycle# where cycle_pos = (cycle + (index*context.vars.cycle_period)/size(vars.platforms))%context.vars.cycle_period ), set(rotate, rotate + 1)]", on_start_level: "[ set(vars.cycle_period, 360 + (abs(midpoint_y - vars.other_wheel_position)*2)/PLATFORM_SPEED), if(vars.other_wheel_position != null, [set(activation_area, [x - 30, min(midpoint_y, vars.other_wheel_position) - img_w, img_w + 60, abs(midpoint_y - vars.other_wheel_position) + img_h*2]), spawn('wheel_big_wooden', midpoint_x, vars.other_wheel_position, facing), spawn('vertical_rope', x+10, min(midpoint_y, vars.other_wheel_position), facing), spawn('vertical_rope', x+img_w-10, min(midpoint_y, vars.other_wheel_position), facing), map([0] * vars.nplatforms, spawn('rope_platform', x, y, facing)) ]), spawn('wheel_big_wooden_shadow',midpoint_x-10, midpoint_y-4,facing, [set('zorder', zorder-2)]), set(vars.rope_len, abs(midpoint_y - vars.other_wheel_position)) ]", on_child_spawned: "[ if(child.type = 'wheel_big_wooden_shadow', set(child.zorder, spawner.zorder-2)), if(child.type = 'rope_platform', set(vars.platforms, vars.platforms + [child])), if(child.type = 'vertical_rope', [set(child.zorder, spawner.zorder-1), set(vars.ropes, vars.ropes + [child])])]", on_draw: "map(vars.ropes, 'rope', rope.set_pos_len(rotate * if(index, -1, 1), vars.rope_len))", editor_info: { category: "platforms", var: [ { name: "other_wheel_position", type: "y", value: "midpoint_y", }, { name: "nplatforms", value: 4, }, ], }, animation: { image: "props/wooden-wheel.png", id: "normal", x: 104, y: 4, w: 80, h: 80, }, }