File: rope_controller.cfg

package info (click to toggle)
frogatto-data 1.3.1%2Bdfsg-4
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid, trixie
  • size: 254,428 kB
  • sloc: xml: 584; python: 396; perl: 249; sh: 126; ruby: 69; makefile: 21
file content (120 lines) | stat: -rw-r--r-- 2,852 bytes parent folder | download | duplicates (3)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
id: "rope_controller",
ignore_collide: true,
no_compile_image: "props/rope-vertical.png,props/rope-vertical-dark.png,props/chainbit.png,props/elevator-track.png,props/dungeon-conveyor-belt-top.png,props/dungeon-conveyor-belt-supports.png,props/dungeon-conveyor-belt-bottom.png",

properties: {
	size: "distance(uv, st)",
	
	ends: "def(p1=null,p2=null) if(p1, execute(self, [ //Set ends to points if provided, otherwise return points.
			set(uv, p1),
			set(st, p2),
			set(draw_area, [0.0, offset_counter, dump(img_w)/2.0, distance(p1,p2)/2.0]),
			set(rotate, angle_to(p1,p2)+90),
			set(mid_x, p1[0]/2 + p2[0]/2),
			set(mid_y, (p1[1]/2 + p2[1]/2) - distance(p1,p2)/2 + img_h/2),
			set(activation_area, [min(p1[0],p2[0]) -200, min(p1[1],p2[1]) -200, abs(p1[0]-p2[0]) +200, abs(p1[1]-p2[1]) +200]),  #xywh#
		]),
		[self.vars.uv, self.vars.st]
	)",
	
	offset: "def(pixels=null) if(pixels,
		execute(self, [
			set(draw_area, [0, pixels, img_w/2, length/2]), 
			set(offset_counter,(offset_counter+pixels)%img_w),
			]),
		self.vars.offset_counter)",

	look: "def(look=null) if(look, execute(self, 
		if(look in available_animations, 
			[	animation(look),
				schedule(2, fire_event('refresh_ends_')), //We have got to wait for img_w to refresh.
			],
			debug(q(Warning - '${look}' isn't a valid animation for the object labelled ${label}.))
			)),
		animation
	)",
},

vars: {
	st: [-96,-96],
	uv: [96,96],
	offset_counter: 0.0,
},

on_create: "[
	look(vars.look),
	ends([u,v],[s,t]),
	]",

on_editor_changed_variable: "fire_event('create')",

on_refresh_ends_: "[ends(uv, st)]",
	
editor_info: {
	category: "controllers",
	help: "A rope graphic that stretches between two points.",
	var: [
		{
			name: "s",
			type: "x",
			value: "x-96",
		},
		{
			name: "t",
			type: "y",
			value: "y-96",
		},
		{
			name: "u",
			type: "x",
			value: "x+96",
		},
		{
			name: "v",
			type: "y",
			value: "y+96",
		},
		{
			name: "look",
			type: "enum",
			value: "'rope'",
			enum_values: ["rope", "dark rope", "chain", "track", "tongue"],
		},
	],
},

animation: [
	{
		image: "props/rope-vertical.png",
		id: "rope",
		x: 0, w: 4, y: 0, h: 4,
		palettes: "@include data/palettes.cfg:seaside_palettes + forest_palettes + cave_palettes",
	},
	{
		image: "props/rope-vertical-dark.png",
		id: "dark rope",
		x: 0, w: 4, y: 0, h: 4,
		palettes: "@include data/palettes.cfg:seaside_palettes + forest_palettes + cave_palettes",
	},
	{
		image: "props/chainbit.png",
		id: "chain",
		x: 0, w: 16, y: 0, h: 16,
		palettes: "@include data/palettes.cfg:dungeon_palettes",
	},
	{
		image: "props/elevator-track.png",
		id: "track",
		x: 0, w: 8, y: 0, h: 16,
		palettes: "@include data/palettes.cfg:dungeon_palettes",
	},
	{
		id: "tongue",
		image: "characters/frogatto-tongueB.png",
		rect: [0,0,7,7],
		frames: 1,
		no_remove_alpha_borders: true,
	},
],
}