~ubuntu-branches/ubuntu/intrepid/enigma/intrepid

« back to all changes in this revision

Viewing changes to data/levels/ant18.lua

  • Committer: Bazaar Package Importer
  • Author(s): Erich Schubert
  • Date: 2005-08-28 15:30:09 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050828153009-sky64kb6tcq37xt5
Tags: 0.92.1-1
* New upstream subversion checkout
* Remove menu.s3m, which we are allowed to distributed but not to modify
  also copyright notice is confusing... (Closes: #321669)
* Rebuild with new libzipios (Closes: #325405)
  I hope this works without a versioned build-dependency
* Added "enigma replaces enigma-data" for upgrades (Closes: #308558)
* Added notes about the fonts copyright.
* updated to policy 3.6.2.1 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
dofile(enigma.FindDataFile("levels/ant.lua"))
3
 
 
4
 
 
5
 
blockmap={
6
 
   "~+~",
7
 
   "+0+",
8
 
   "~+~",
9
 
}
10
 
 
11
 
blocksx = 9
12
 
blocksy = 5
13
 
blockw, blockh = get_map_size(blockmap)
14
 
 
15
 
sahara=     cell{floor="fl-sahara"}
16
 
tigris=     cell{floor="fl-tigris"}
17
 
metal=      cell{floor="fl-metal"}
18
 
solidfloor= cell{{{checkerfloor,{sahara,tigris; sidex=blockw, sidey=blockh, offset=1}}}}
19
 
borderstone=cell{{{randomfloor,{cell{stone={face="st-rock2"}},cell{stone={face="st-rock5"}},0.15}}}}
20
 
marble=     cell{actor={"ac-blackball", {player=0}}}
21
 
 
22
 
oxydstones = {n=0}
23
 
 
24
 
cells={}
25
 
cells["~"]=abyss
26
 
cells["0"]=cell{{{solidfloor},{oxyd}}}
27
 
cells[" "]=solidfloor
28
 
 
29
 
function place_new_oxyd_stone(count)
30
 
   count = count or 1
31
 
 
32
 
   for _=1,count do
33
 
      --pick place for new oxyd
34
 
      local mox,moy,ox,oy = 0
35
 
      local key = ""
36
 
      local num = oxydstones.n+1
37
 
 
38
 
      if num>14 then
39
 
         return
40
 
      end
41
 
 
42
 
      repeat
43
 
         mox, moy=random(0,blocksx-1),random(0,blocksy-1)
44
 
         key = getkey(mox, moy)
45
 
         ox, oy=mox*blockw+1, moy*blockh+1
46
 
      until (not(oxydstones[key]))and(((mod(mox,2)==0)and(mod(moy,2)==0)))
47
 
 
48
 
      --well, place found. Now construct triggering function
49
 
      local funcn = "trigger_"..num
50
 
      func0 = "function() "..
51
 
              "  if (oxydstones[\""..key.."\"] == 0) then "..
52
 
              "    oxydstones[\""..key.."\"] = 1 "..
53
 
              "    place_new_oxyd_stone(2) "..
54
 
              "  end "..
55
 
              "end "
56
 
 
57
 
      dostring(funcn.." = "..func0)
58
 
 
59
 
      --add oxyd and triggers
60
 
      cells["+"]=%cell{parent=metal,item={face="it-trigger",attr={action="callback", target=funcn, invisible=1}}}
61
 
      draw_map(ox, oy, blockmap)
62
 
 
63
 
      oxydstones[key] = 0
64
 
      oxydstones.n = oxydstones.n+1
65
 
   end
66
 
end
67
 
 
68
 
 
69
 
create_world(blocksx*blockw+2, blocksy*blockh+2)
70
 
fill_world_func(solidfloor)
71
 
draw_border_func(borderstone)
72
 
marble(blockw+1,1)
73
 
 
74
 
place_new_oxyd_stone(1)
75
 
display.SetFollowMode(display.FOLLOW_SCROLLING)