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
|
[object_type]
id="rope_angled_controller"
ignore_collide="true"
on_create="[
set(midpoint_x, (x_2+x_1)/2),
set(y, (y_2+y_1)/2 - (length/2)),
set(draw_area, [0, 0, img_w/2, length/2]),
set(activation_area, [min(x_1,x_2) -200, min(y_1,y_2) -200, abs(x_1-x_2) +200, abs(y_1-y_2) +200]), #xywh#
set(rotate,(angle(x_1,y_1,x_2,y_2)-90) )
]"
[editor_info]
category="controllers"
help="A controller for angled ropes."
[var]
name="x_1"
type="x"
value="x-100"
[/var]
[var]
name="y_1"
type="y"
value="y-100"
[/var]
[var]
name="x_2"
type="x"
value="x+100"
[/var]
[var]
name="y_2"
type="y"
value="y+100"
[/var]
[/editor_info]
[properties]
length="length(x_1,y_1,x_2,y_2)"
set_ends="def(new_x1,new_y1,new_x2,new_y2) [set(vars.x_1,new_x1),set(vars.y_1,new_y1),set(vars.x_2,new_x2),set(vars.y_2,new_y2),fire_event(me,'create'),]"
set_offset="def(pixels) execute(me, set(draw_area, [0, pixels, img_w/2, length/2]))"
[/properties]
[animation]
h="4"
id="normal"
image="props/rope-vertical.png"
w="4"
x="0"
y="0"
[/animation]
[animation]
frame_info="3,0,2,0,1013,528,11,16"
id="chain"
image="compiled-1.png"
rect="1010,528,1025,543"
[/animation]
[animation]
frame_info="0,0,0,0,1016,662,8,16"
id="track"
image="compiled-2.png"
rect="1016,662,1023,677"
[/animation]
[/object_type]
|