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
|
{
id: "falling_platform",
always_active: true,
platform_area: [0,0,188,1],
properties: {
standing_midpoint: "midpoint_x + (rotated_rect[0] + rotated_rect[2])/4",
tilt_accel: "if(level.player.standing_on != me, 0,
((level.player.midpoint_x - standing_midpoint)/10)*0.0001)",
base_rect: "[-img_w, -img_h, img_w, -img_h, img_w, img_h, -img_w, img_h]",
rotated_rect: "rotate_rect(0, 3000, vars.tilt, base_rect)",
offset_rect: "map(range(8), 'n', (r1[n] - r2[n])/2) where r1 = rotated_rect, r2 = base_rect",
},
vars: {
tilt: 0,
tilt_velocity: 0,
},
on_process: "[
if(abs(vars.tilt) > 90, die()),
add(y, abs(vars.tilt_velocity*5)),
set(vars.tilt_velocity, vars.tilt_velocity*1.02 + tilt_accel),
add(vars.tilt, vars.tilt_velocity),
set(platform_area, [r[0]/2, r[1]/2+16, img_w/2 + r[2]/2]),
set(platform_offsets, [0, (rotated_rect[3] - rotated_rect[1])/2]),
set(custom_draw, [0, 1, 2, 3, r])] where r = offset_rect",
editor_info: {
category: "platforms",
},
animation: {
id: "normal",
no_remove_alpha_borders: true,
image: "props/falling-platform.png",
x: 0,
y: 0,
w: 208,
h: 160,
},
}
|