Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 148 lines (144 sloc) 1.88 kb
0d16da07 »
2009-08-15 Initial commit
1
2
3 module Tileset
4 def self.load_map(window, filename)
5
6 @capa = File.readlines(filename).map { |line| line.chomp }
5a27dcab »
2009-09-06 npcs in separate files, loaded from their map, initial sprites positi…
7 @height = @capa.size - 1
8 @width = @capa[1].size
0d16da07 »
2009-08-15 Initial commit
9 @tiles = Array.new(@width) do |x|
10 Array.new(@height) do |y|
5a27dcab »
2009-09-06 npcs in separate files, loaded from their map, initial sprites positi…
11 case @capa[y+1][x, 1]
0d16da07 »
2009-08-15 Initial commit
12 when '0'
13 0
14 when '1'
15 1
16 when '2'
17 2
18 when '3'
19 3
20 when '4'
21 4
22 when '5'
23 5
24 when '6'
25 6
26 when '7'
27 7
28 when '8'
29 8
30 when '9'
31 9
32 when 'a'
33 10
34 when 'b'
35 11
36 when 'c'
37 12
38 when 'd'
39 13
40 when 'e'
41 14
42 when 'f'
43 15
44 when 'g'
45 16
46 when 'h'
47 17
48 when 'i'
49 18
50 when 'j'
51 19
52 when 'k'
53 20
54 when 'l'
55 21
56 when 'm'
57 22
58 when 'n'
59 23
60 when 'o'
61 24
62 when 'p'
63 25
64 when 'q'
65 26
66 when 'r'
67 27
68 when 's'
69 28
70 when 't'
71 29
72 when 'u'
73 30
74 when 'v'
75 31
76 when 'w'
77 32
78 when 'x'
79 33
80 when 'y'
81 34
82 when 'z'
83 35
84 when 'A'
85 36
86 when 'B'
87 37
88 when 'C'
89 38
90 when 'D'
91 39
92 when 'E'
93 40
94 when 'F'
95 41
96 when 'G'
97 42
98 when 'H'
99 43
100 when 'I'
101 44
102 when 'J'
103 45
104 when 'K'
105 46
106 when 'L'
107 47
108 when 'M'
109 48
110 when 'N'
111 49
112 when 'O'
113 50
114 when 'P'
115 51
116 when 'Q'
117 52
118 when 'R'
119 53
120 when 'S'
121 54
122 when 'T'
123 55
124 when 'U'
125 56
126 when 'V'
127 57
128 when 'W'
129 58
130 when 'X'
131 59
132 when 'Y'
133 60
134 when 'Z'
135 61
136 #when '%'
137 # '%'
138 else
139 nil
140 end #case
141 end # y
142 end # x
5a27dcab »
2009-09-06 npcs in separate files, loaded from their map, initial sprites positi…
143 @npcs = @capa[0].to_s.split(';')
144 @data = [@tiles, @width, @height, @npcs]
0d16da07 »
2009-08-15 Initial commit
145 return @data
146 end # def
147 end #module
Something went wrong with that request. Please try again.