gm.map 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #
  2. # gm.map
  3. #
  4. # Syntax:
  5. # 'hash' introduces a comment
  6. # tile <ascii> <mapto> <top> <right> <bottom> <left>
  7. # map the <ascii> code to the specified <mapto> code, if the other for tiles match
  8. # If one of the other four tiles is 0, then ignore this tile (wildcard)
  9. # thing ... same as tile, but can be redefined at any time, should redefine to char
  10. # itemkey <iname> <ascii> <bg-tile> ... similar thing, but will connect to an item and assign the <backgroundmapto> instead
  11. #
  12. # summery:
  13. # tile: static fixed thing for all maps
  14. # thing: static thing for some maps
  15. # itemkey: dynamic objects like changing doors, boxes or monsters
  16. #
  17. # item <iname> <foregroundmapto>
  18. # defines a global template for an object.
  19. # anyting on the map, which might disappear, move or change has to be an item
  20. # itemuse <iname> <ascii>
  21. # only within active map. <mapto> will be the background tile for the char
  22. # the current foreground tile might still be differrent and is set during iteminit
  23. # connects the ascii char with the given ascii char on the map to get the xy pos.
  24. # iteminit <iname>
  25. # <procedure>
  26. # endproc
  27. # procedure, which is called, when the item is created,
  28. # receives position, where it should be created on the map
  29. # itemhit <iname>
  30. # procedure, which is called, when the item is hit by something
  31. # - returns 0 if the item hitting item has to be stopped
  32. # - may move itself
  33. # - may change its own shape (tile)
  34. # - may modify its status
  35. # endproc
  36. #
  37. # example "normal door, status=closed"
  38. # 1. hit: status=open, change tile to open door, return 0
  39. # 2. hit: return 1 (hero can pass)
  40. # example "creature, status=5 life"
  41. # 1. hit: get hitting obj attac damage, reduce life --> status=2, apply attack damage hitting object, return 0
  42. # 2. hit: get hitting obj attac damage, reduce life --> status=0, remove object from map, return 0
  43. # 3. hero can continue
  44. #
  45. # itemstep <iname>
  46. # executed every step
  47. # - moving items can move towards hero or others
  48. # endproc
  49. # mapinit
  50. # executed during map init
  51. # endproc
  52. #
  53. #
  54. # map <name> <width> <height>
  55. # Create a map with the given name and size. this must be followed by :
  56. # endmap
  57. # Finish the current map
  58. #
  59. tile 32 32 # map space to space
  60. tile '+ $80 0 '- '| 0
  61. tile '+ $80 0 '- '+ 0
  62. tile '+ $80 0 '+ '| 0
  63. tile '+ $80 0 '+ '+ 0
  64. tile '+ $81 0 0 '| '-
  65. tile '+ $81 0 0 '+ '-
  66. tile '+ $81 0 0 '| '+
  67. tile '+ $81 0 0 '+ '+
  68. tile '+ $82 '| '- 0 0
  69. tile '+ $82 '+ '- 0 0
  70. tile '+ $82 '| '+ 0 0
  71. tile '+ $82 '+ '+ 0 0
  72. tile '+ $83 '| 0 0 '-
  73. tile '+ $83 '+ 0 0 '-
  74. tile '+ $83 '| 0 0 '+
  75. tile '+ $83 '+ 0 0 '+
  76. tile '+ $84 '| '- '| 0
  77. tile '+ $84 '+ '- '| 0
  78. tile '+ $84 '| '+ '| 0
  79. tile '+ $84 '+ '+ '| 0
  80. tile '+ $84 '| '- '+ 0
  81. tile '+ $84 '+ '- '+ 0
  82. tile '+ $84 '| '+ '+ 0
  83. tile '+ $84 '+ '+ '+ 0
  84. tile '+ $85 '| 0 '| '-
  85. tile '+ $85 '+ 0 '| '-
  86. tile '+ $85 '| 0 '+ '-
  87. tile '+ $85 '+ 0 '+ '-
  88. tile '+ $85 '| 0 '| '+
  89. tile '+ $85 '+ 0 '| '+
  90. tile '+ $85 '| 0 '+ '+
  91. tile '+ $85 '+ 0 '+ '+
  92. tile '+ $86 0 '- '| '-
  93. tile '+ $86 0 '+ '| '-
  94. tile '+ $86 0 '- '+ '-
  95. tile '+ $86 0 '+ '+ '-
  96. tile '+ $86 0 '- '| '+
  97. tile '+ $86 0 '+ '| '+
  98. tile '+ $86 0 '- '+ '+
  99. tile '+ $86 0 '+ '+ '+
  100. tile '+ $87 '| '- 0 '-
  101. tile '+ $87 '+ '- 0 '-
  102. tile '+ $87 '| '+ 0 '-
  103. tile '+ $87 '+ '+ 0 '-
  104. tile '+ $87 '| '- 0 '+
  105. tile '+ $87 '+ '- 0 '+
  106. tile '+ $87 '| '+ 0 '+
  107. tile '+ $87 '+ '+ 0 '+
  108. tile '+ $88 '| '- '| '-
  109. tile '+ $88 '+ '- '| '-
  110. tile '+ $88 '| '+ '| '-
  111. tile '+ $88 '+ '+ '| '-
  112. tile '+ $88 '| '- '+ '-
  113. tile '+ $88 '+ '- '+ '-
  114. tile '+ $88 '| '+ '+ '-
  115. tile '+ $88 '+ '+ '+ '-
  116. tile '+ $88 '| '- '| '+
  117. tile '+ $88 '+ '- '| '+
  118. tile '+ $88 '| '+ '| '+
  119. tile '+ $88 '+ '+ '| '+
  120. tile '+ $88 '| '- '+ '+
  121. tile '+ $88 '+ '- '+ '+
  122. tile '+ $88 '| '+ '+ '+
  123. tile '+ $88 '+ '+ '+ '+
  124. tile '| $7e 0 0 '| 0
  125. tile '| $7e 0 0 '+ 0
  126. tile '| $7f 0 0 0 0
  127. tile '- $7d 0 0 0 0
  128. tile '. $6a # stone 2
  129. tile ': $6b # stone 3
  130. thing 'f $74 # fire
  131. thing '^ $73 # door open
  132. thing 'C $79 # cupboard
  133. thing 'b $7a # bookshelf
  134. thing 'c $78 # chair
  135. thing 't $7b # table
  136. thing 'T $7c # throne
  137. thing 'h $9c # chest
  138. thing 'H $92 # hut
  139. thing 'K $93 # kingdom
  140. item normal_door $72 # $72 = door closed --> inital tile
  141. itemkey normal_door 'x $73 # $73 = door open --> this will be placed on the map, the item can destroy itself, but this tile will stay
  142. iteminit normal_door
  143. print(add(1,2))
  144. print(add(3,4))
  145. print(add(1234,5678))
  146. endproc
  147. itemhit normal_door
  148. endproc
  149. itemstep normal_door
  150. endproc
  151. item spider $54
  152. itemkey spider 'S 32 # use blank as background under 'S'
  153. iteminit spider
  154. endproc
  155. itemhit spider
  156. endproc
  157. itemstep spider
  158. endproc
  159. map test 20 9
  160. mapinit
  161. setPos(3,2)
  162. setItemPos(0)
  163. endproc
  164. : K H
  165. : . .
  166. : ...........
  167. : . .
  168. :+-----^--x--C--b---+
  169. :| T f|
  170. :|ctc h S |
  171. :| c S |
  172. :+-----^-----x------+
  173. endmap
  174. #thing 'S $54 # Spider
  175. thing 'k $a0 # key
  176. map first 12 12
  177. :+---+ +---+
  178. :| | | |
  179. :+-+ +--+ | |
  180. : | +-+ |
  181. : | | |
  182. : | |
  183. : +-+ -----+
  184. : | Sk|
  185. : +------+
  186. endmap