git @ Cat's Eye Technologies Gemooy / a9d5e47
Increment and decrement playfield cells. Now, the debugging! Chris Pressey 1 year, 3 months ago
1 changed file(s) with 30 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
8383 end
8484 end
8585
86 local increment_playfield_at = function(p, x, y)
87 local data = p:peek(x, y)
88 if data == " " then
89 data = "#"
90 elseif data == "#" then
91 data = "@"
92 elseif data == "@" then
93 data = " "
94 else
95 error("What is this i cannot even " + data)
96 end
97 p:poke(x, y, data)
98 end
99
100 local decrement_playfield_at = function(p, x, y)
101 local data = p:peek(x, y)
102 if data == " " then
103 data = "@"
104 elseif data == "@" then
105 data = "#"
106 elseif data == "#" then
107 data = " "
108 else
109 error("What is this i cannot even " + data)
110 end
111 p:poke(x, y, data)
112 end
113
86114 --
87115 -- Loader
88116 --
159187 ix = ix + dx
160188 iy = iy + dy
161189 elseif (dx == -1 and dy == -1) or (dx == 1 and dy == -1) then
162 -- FIXME p.increment(dp.x, dp.y);
163 px = px
190 increment_playfield_at(p, px, py)
164191 elseif (dx == -1 and dy == 1) or (dx == 1 and dy == 1) then
165 -- FIXME p.decrement(dp.x, dp.y);
166 px = px
192 decrement_playfield_at(p, px, py)
167193 end
168194 end
169195