File: rope_angled_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 (112 lines) | stat: -rw-r--r-- 2,956 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
{
id: "rope_angled_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: {
	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]), set(offset_counter,(offset_counter+pixels)%img_w)])",
	offset: { get: "vars.offset_counter", set: "set(vars.offset_counter, value%img_w)" },

	set_ends_and_offset: "def(new_x1, new_y1, new_x2, new_y2, pixels)
	  [
	   set(self.vars.x_1, new_x1),
	   set(self.vars.y_1, new_y1),
	   set(self.vars.x_2, new_x2),
	   set(self.vars.y_2, new_y2),
	   set(self.vars.offset_counter, offset),
	   set(self.midpoint_x, (new_x2 + new_x1)/2),
	   set(self.y, (new_y2+new_y1)/2 - len/2),
	   set(self.draw_area, [0, offset, self.img_w/2, len/2]),
	   set(self.activation_area, [min(new_x1,new_x2) - 200, min(new_y1,new_y2) - 200, abs(new_x1 - new_x2) + 200, abs(new_y1 - new_y2) + 200]),
	   set(self.rotate, (angle(new_x1, new_y1, new_x2, new_y2) - 90))
	  ] where len = length(new_x1, new_y1, new_x2, new_y2),
	          offset = (self.vars.offset_counter+pixels)%self.img_w"
	
},

vars: {
	offset_counter: 0,
	x_1: 0,
	x_2: 0,
	y_1: 0,
	y_2: 0
},
on_create: "
[
		set(midpoint_x, (vars.x_2+vars.x_1)/2),
		set(y, (vars.y_2+vars.y_1)/2 - (length/2)),
		set(draw_area, [0, offset_counter, img_w/2, length/2]),
		set(activation_area, [min(vars.x_1,vars.x_2) -200, min(vars.y_1,vars.y_2) -200, abs(vars.x_1-vars.x_2) +200, abs(vars.y_1-vars.y_2) +200]),  #xywh#
		set(rotate,(angle(vars.x_1,vars.y_1,vars.x_2,vars.y_2)-90) )
		]
",
on_load: "[fire_event('create')]",
	
editor_info: {
	category: "controllers",
	help: "A controller for angled ropes.",
	var: [
		{
			name: "x_1",
			type: "x",
			value: "x-100",
		},
		{
			name: "y_1",
			type: "y",
			value: "y-100",
		},
		{
			name: "x_2",
			type: "x",
			value: "x+100",
		},
		{
			name: "y_2",
			type: "y",
			value: "y+100",
		},
	],
},

animation: [
	{
		image: "props/rope-vertical.png",
		id: "normal",
		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",
		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",
	},
],
}