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
|
[object_type]
id=rope_angled_controller
ignore_collide=true
[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]
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) )
]"
[animation]
image=props/rope-vertical.png
id=normal
x=0
w=4
y=0
h=4
[/animation]
[animation]
image=props/chainbit.png
id=chain
x=0
w=16
y=0
h=16
[/animation]
[animation]
image=props/elevator-track.png
id=track
x=0
w=8
y=0
h=16
[/animation]
[/object_type]
|