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
|
[object_type]
id=rope_controller
ignore_collide=true
# [editor_info]
# category=controllers
# help="A controller for angled ropes."
# [var]
# name=end_x
# type=x
# value="x+200"
# [/var]
# [var]
# name=end_y
# type=y
# value="y+100"
# [/var]
# [/editor_info]
functions="
def stretch_rope(xa, ya, xb, yb) [
map(range(totLength/len), 'range',
spawn('rope_controller.rope', pa, pb, 0, set(rotate, angle(xa, ya, xb, yb)-90))
where pa = xa + ((xb - xa)*(point*100000/totLength))/100000
where pb = ya + ((yb - ya)*(point*100000/totLength))/100000
where point = range * len
) where totLength = length(xa, ya, xb, yb)
where len = 6
];
"
on_create="[
stretch_rope(x,y,vars.end_x,vars.end_y),
set(alpha, 30)
]"
[animation]
id=normal
image=effects/particles.png
x=179
y=42
w=28
h=28
frames=1
duration=1000
[/animation]
[object_type]
id=rope
[animation]
id=normal
image=props/rope-vertical.png
rect=0,0,3,3
pad=0
frames=1
duration=5000000
[/animation]
[/object_type]
[/object_type]
|