File: scripts.cfg

package info (click to toggle)
frogatto-data 1.0-2
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 155,116 kB
  • sloc: makefile: 1
file content (110 lines) | stat: -rw-r--r-- 4,452 bytes parent folder | download
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
[editor_scripts]

[script]
id="Simple World"
script="
def add_enemy(left, right, ypos)
   add_object(enemy[0], left + (1d max(1, (right - left) - enemy[1])), ypos - enemy[2], -1)
   where enemy = choose(
    [
	  ['ant_black', 40, 60],
	  ['ant_black', 40, 60],
	  ['ant_black', 40, 60],
	  ['ant_red', 40, 60],
	  ['ant_red', 40, 60],
	  ['ant_flying_black', 40, 150],
	  ['ant_flying_black', 40, 190],
	  ['ant_flying_black', 40, 240]
	]
   )
;
def add_prop(left, right, ypos)
   add_object(prop[0], left + (1d max(1, (right - left) - prop[1])), ypos - prop[2]*2, 1)
   where prop = choose(
    [
     ['tree-world1', 80, 120],
     ['tree-world1-2', 80, 120],
     ['tree-world1-3', 80, 120]
	]
   )
;
def prettify_platform(left, right, ypos)
  map([0] * 1d((right - left)/32), add_prop(left, right, ypos))
;

def add_enemies_to_platform(left, right, ypos)
  map([0] * 1d((right - left)/128), add_enemy(left, right, ypos))
;


def generate_heights(tile_id, left, top, right, bottom, last_height)
  if(left < right and height < bottom,
     [prettify_platform(left*32, min(right, left + platform_length)*32, height*32),
      add_enemies_to_platform(left*32, min(right, left + platform_length)*32, height*32),
	  add_tiles(tile_id, left, height, min(right, left + platform_length), bottom),
	  generate_heights(tile_id, left + platform_length, top, right, bottom, height)])
		  where platform_length = 2d6, height = last_height + (1d5 - 1d5);

      generate_heights('nrk', left, top, right, bottom, (top+bottom)/2)
         where top = min(map(cells, y)), bottom = max(map(cells, y)),
		       left = min(map(cells, x)), right = max(map(cells, x))"
[/script]

[script]
id="Add Grass"
script="
map(cells, if(find(down.tiles, 'tile', tile = 'nrk') and
             (not find(tiles, 'tile', tile = 'nrk')) and
			 (not find(left.tiles, 'tile', tile = 'nrk')) and
			 (not find(right.tiles, 'tile', tile = 'nrk')),
			    add_tiles('ngs', x, y)))"
[/script]
[script]
id="Smooth Rocks"
script="
#function which counts the gray rocks in a column. 'cell' is the cell at
 the top of the column, and 'count' is the number of cells in the column.#
def count_nrk_in_column(cell, count)
  if(count <= 0, 0, if('nrk' in cell.tiles, 1, 0) + count_nrk_in_column(cell.down, count-1));

#function which counts the gray rocks in a rectangle. 'cell' is the cell
 at the top-left of the rect, and 'nrows' and 'ncols' give the size of the rect#
def count_nrk_in_rect(cell, nrows, ncols)
  if(ncols <= 0, 0, count_nrk_in_column(cell, nrows) + count_nrk_in_rect(cell.right, nrows, ncols-1));

#for all cells with 'nrk' in them, calculate the number of nrk tiles in a
 3 tile radius. If this number is greater than 30, leave the nrk there. If
 it's greater than 15, then make leaving the nrk there random; otherwise clear
 the nrk.#
map(filter(cells, 'nrk' in tiles), 'cell',
  if(count < 15 or count < 30 and 1d2 = 1, remove_tiles('nrk', cell.x, cell.y)) where count = count_nrk_in_rect(cell.left.left.left.up.up.up, 7, 7))
"
[/script]

[script]
id="Round Grey Rocks"
script="
#function which counts the gray rocks in a column. 'cell' is the cell at
 the top of the column, and 'count' is the number of cells in the column.#
def count_nrk_in_column(cell, count)
  if(count <= 0, 0, if('nrk' in cell.tiles, 1, 0) + count_nrk_in_column(cell.down, count-1));

#function which counts the gray rocks in a rectangle. 'cell' is the cell
 at the top-left of the rect, and 'nrows' and 'ncols' give the size of the rect#
def count_nrk_in_rect(cell, nrows, ncols)
  if(ncols <= 0, 0, count_nrk_in_column(cell, nrows) + count_nrk_in_rect(cell.right, nrows, ncols-1));

#for all cells with nothing in them, calculate the number of nrk tiles in a
 4 tile radius. Do the opposite of below to round in corners.#
map(filter(cells, not ('nrk' in tiles)), 'cell',
  if(count > 40 or count > 45 and 1d2 = 1, add_tiles('nrk', cell.x, cell.y)) where count = count_nrk_in_rect(cell.left.left.left.left.up.up.up.up, 9, 9)) +

#for all cells with 'nrk' in them, calculate the number of nrk tiles in a
 4 tile radius. If this number is greater than 30, leave the nrk there. If
 it's greater than 15, then make leaving the nrk there random; otherwise clear
 the nrk.#
map(filter(cells, 'nrk' in tiles), 'cell',
  if(count < 30 or count < 35 and 1d2 = 1, remove_tiles('nrk', cell.x, cell.y)) where count = count_nrk_in_rect(cell.left.left.left.left.up.up.up.up, 9, 9)) 
"
[/script]
[/editor_scripts]