Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
24 May, 2013, 00:36:18 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2 3   Go Down
  Print  
Author Topic: Owl — A fast, lightweight, and flexible game engine for the TI-Nspire -  (Read 1849 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 16:11:27
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« on: 25 December, 2011, 15:01:21 »
+4

I've been working on a tile engine I named Owl. I had tried it before, but it was generally quite slow and a pain in the butt to use and adapt. I tried it again, but this time a lot more seriously, and it's been progressing nicely. My goal is to make a fast (fast as in TI-Nspire Lua fast), clean, flexible and lightweight tile map engine that anyone can use. The engine currently supports arbitrary-sized maps with scrolling, easy tile, object (anything that can change state during the game), and event (detonate the nuke when Link reads that sign) management. To keep the games responsive, playable and frustration-free, scrolling and movement is blocky, i.e. no smooth scrolling or fancy walking animations (although there will be basic animation management).

As mentioned up there, graphics-heavy TI-Nspire Lua programs (read: programs that use the TI.Image format to draw images a lot) are usually rather slow. But because sprites with a lot of transparent pixels and primitive shapes can be drawn relatively quickly, to tackle the issue of slowness I decided that every tile is defined by an optional background color and and a (hopefully) partially transparent sprite that comes on top of it. That in most cases improves the speed quite a bit. Also I'm working on a map format that will increase the FPS by a good 10%—40%.

All I can give you right now is the current source code, which is kept and updated whenever I commit a change on github (I repeat, it's not ready for public use): https://github.com/Hoffa/Owl

I'll at some point write some sort of documentation and release a public version (when I feel it works and am generally pleased with it, might take some time), but until then you can play around with the code on github if you wish.

EDIT: on hold while I work on the SDL port.
« Last Edit: 09 March, 2012, 12:53:41 by hoffa » Logged
adriweb
Editor
LV9 Veteran (Next: 1337)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 12:02:44
Date Registered: 13 April, 2011, 18:42:59
Location: South of France
Posts: 1197


Total Post Ratings: +185

View Profile WWW
« Reply #1 on: 25 December, 2011, 15:33:01 »
0

Awesome !

I'll take a close look Cheesy

Here's the source code (extracted with the sdk ... Cheesy)
(and optimized images (replaced \000 with \0


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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
Coyote = class()

function Coyote:init(x, y, width, height, options)
    options = options or {}
    self.gc = platform.gc()
    self.x = x
    self.y = y
    self.width = width
    self.height = height
    self.tiles = {}
    self.controls = options.controls or {up = "up",
                                         down = "down",
                                         left = "left",
                                         right = "right"}
    self.player = {}
    self.tileSize = options.tileSize or 16
    self.scrollThreshold = options.scrollThreshold or 1
    self.outOfBoundsColor = options.outOfBoundsColor or {0, 0, 0}
    self.tileCount = 0
end

function Coyote:loadTile(sprites, color, walkable)
    self.tileCount = self.tileCount + 1
    self.tiles[self.tileCount] = {}
    local tile = self.tiles[self.tileCount]
    if type(sprites) == "string" then
        tile.sprites = {image.new(sprites)}
    elseif type(sprites) == "table" then
        tile.sprites = {}
        for i = 1, #sprites do
            tile.sprites[i] = image.new(sprites[i])
        end
    end
    tile.color = color
    tile.walkable = walkable
    return self.tileCount
end

function Coyote:handleMoveKey(key)
    local direction = (key == self.controls.up and 1)
                    or (key == self.controls.right and 2)
                    or (key == self.controls.down and 3)
                    or (key == self.controls.left and 4)
    local map = self.area.map
    local player = self.player
    if direction == self.player.direction then
        local x = player.x + ((direction == 2 and 1) or (direction == 4 and -1) or 0)
        local y = player.y + ((direction == 1 and -1) or (direction == 3 and 1) or 0)
        if self.tiles[map.data[y][x]].walkable then
            local object = self.area:getObjectAt(x, y)
            if not object or self.tiles[object.tile].walkable then
                player.x = x
                player.y = y
            end
        end
        if self:processEvents() then
            return
        end
        map.x = map.x + ((player.x <= map.x + self.scrollThreshold and -1)
                         or (player.x + self.scrollThreshold > map.x + self.width and 1)
                         or 0)
        map.y = map.y + ((player.y <= map.y + self.scrollThreshold and -1)
                         or (player.y + self.scrollThreshold > map.y + self.height and 1)
                         or 0)
    end
    self.player.direction = direction
end

function Coyote:handleEventKey()
    self:processEvents(true)
end

function Coyote:processEvents(keyPressed)
    for i = 1, #self.area.events do
        local event = self.area.events[i]
        if event.x == self.player.x
        and event.y == self.player.y
        and event.keyPress == (keyPressed or false) then
            if not event.direction
            or event.direction == self.player.direction then
                event.callback()
                return true
            end
        end
    end
end

function Coyote:setPlayer(tile, x, y, offsetX, offsetY, direction)
    local player = self.player
    player.tile = tile
    player.x = x
    player.y = y
    player.offset = {x = offsetX or 0, y = offsetY or 0}
    player.direction = direction or 3
end

function Coyote:setArea(area)
    self.area = area
end

function Coyote:movePlayer(x, y)
    self.player.x = x
    self.player.y = y
end

function Coyote:relativeToAbsolutePosition(x, y)
    return ((x - self.area.map.x - 1) * self.tileSize) + self.x,
           ((y - self.area.map.y - 1) * self.tileSize) + self.y
end

function Coyote:drawTileMap()
    local x = self.x
    local y = self.y
    local area = self.area
    for i = area.map.y + 1, area.map.y + self.height do
        for j = area.map.x + 1, area.map.x + self.width do
            if j > 0 and j <= area.map.width and i > 0 and i <= area.map.height
            and area.map.data[i][j] > 0 then
                local tile = self.tiles[area.map.data[i][j]]
                if tile.color then
                    self.gc:setColorRGB(tile.color[1], tile.color[2], tile.color[3])
                    self.gc:fillRect(x, y, self.tileSize, self.tileSize)
                end
                if tile.sprites then
                    self.gc:drawImage(tile.sprites[1], x, y)
                end
            elseif self.outOfBoundsColor then
                self.gc:setColorRGB(self.outOfBoundsColor[1],
                                    self.outOfBoundsColor[2],
                                    self.outOfBoundsColor[3])
                self.gc:fillRect(x, y, self.tileSize, self.tileSize)
            end
            x = x + self.tileSize
        end
        x = self.x
        y = y + self.tileSize
    end
end

function Coyote:drawObjects()
    local map = self.area.map
    for name, object in pairs(self.area.objects) do
        if object.x > map.x and object.x <= map.x + self.width
        and object.y > map.y and object.y <= map.y + self.height then
            local x, y = self:relativeToAbsolutePosition(object.x, object.y)
            self.gc:drawImage(self.tiles[object.tile].sprites[object.currentSprite], x, y)
        end
    end
end

function Coyote:drawPlayer()
    local x, y = self:relativeToAbsolutePosition(self.player.x, self.player.y)
    self.gc:drawImage(self.tiles[self.player.tile].sprites[self.player.direction],
                      x + self.player.offset.x, y + self.player.offset.y)
end

function Coyote:draw()
    self:drawTileMap()
    self:drawObjects()
    self:drawPlayer()
end

Area = class()

function Area:init(super, map, x, y)
    self.super = super
    self.map = {data = map,
                width = #map[1],
                height = #map,
                x = x or 0,
                y = y or 0}
    self.objects = {}
    self.events = {}
end

function Area:newObject(name, tile, x, y)
    self.objects[name] = {tile = tile, x = x, y = y, currentSprite = 1}
end

function Area:newEvent(x, y, direction, keyPress, callback)
    table.insert(self.events, {x = x, y = y,
                               direction = direction,
                               keyPress = keyPress,
                               callback = callback})
end

function Area:getObjectAt(x, y)
    for _, object in pairs(self.objects) do
        if object.x == x and object.y == y then
            return object
        end
    end
end

function Area:moveObject(name, x, y)
    self.objects[name].x = x
    self.objects[name].y = y
end

function Area:setObjectSprite(name, spriteNumber)
    self.objects[name].currentSprite = spriteNumber
end

function Area:destroyObject(name)
    self.objects[name] = nil
end

function a1Toa2()
    coyote:setArea(a2)
    coyote:movePlayer(4, 5)
end

function a2Toa1()
    coyote:setArea(a1)
    coyote:movePlayer(12, 2)
end

function signRead()
    a2:destroyObject("blocking_bush")
end

function on.arrowKey(key)
    coyote:handleMoveKey(key)
    platform.window:invalidate()
end

function on.enterKey()
    coyote:handleEventKey()
    platform.window:invalidate()
end

local bushS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0I\166I\166I\166\0\0\165\148\165\148\165\148\0\0\0\0\165\148\165\148\165\148\0\0I\166I\166I\166I\166I\166\0\0\165\148I\166I\166\0\0\165\148\165\148\0\0I\166I\166\165\148\0\0I\166I\166I\166\0\0\0\0\165\148I\166\0\0\0\0\165\148\165\148\0\0\0\0I\166\165\148\0\0\0\0I\166\0\0\165\148\165\148\165\148\165\148\0\0\0\0\165\148\165\148\0\0\0\0\165\148\165\148\165\148\165\148\231\149\165\148I\166I\166\0\0\0\0\165\148\165\148\0\0\0\0\165\148\165\148\0\0\0\0I\166I\166\165\148\165\148I\166\0\0\0\0\0\0\0\0\165\148I\166I\166\165\148\0\0\0\0\0\0\0\0I\166\165\148\165\148\165\148\0\0\0\0\0\0\0\0\165\148I\166I\166\165\148\0\0\0\0\0\0\0\0\165\148\165\148\0\0\165\148\165\148\165\148\165\148\165\148\165\148\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148\231\149\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\165\148I\166\0\0\0\0\0\0\165\148\165\148\0\0\0\0\165\148\165\148\0\0\0\0\0\0I\166\165\148\165\148I\166I\166\0\0\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\0\0I\166I\166\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148\0\0\165\148\165\148\0\0\0\0\165\148I\166\0\0\0\0I\166\165\148\0\0\0\0\165\148\165\148\0\0\0\0\0\0\165\148I\166\0\0\165\148\165\148I\166I\166\165\148\165\148\0\0I\166\165\148\0\0\0\0I\166\0\0\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0I\166I\166I\166\0\0\0\0\0\0\0\0\0\0\165\148\165\148\0\0\0\0\0\0\0\0\0\0I\166I\166"
local flowersS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\150\215\150\215\150\215\0\0\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\150\215\0\0\150\215\150\215\150\215\0\0\150\215\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\0\0\150\215\150\215\014\170\014\170\014\170\150\215\150\215\0\0\198\153\198\153\0\0\198\153\198\153\198\153\0\0\0\0e\149\150\215\014\170\014\170\014\170\150\215e\149\0\0\198\153\0\0\198\153\198\153\198\153\0\0\0\0\0\0e\149e\149\150\215\150\215\150\215e\149e\149\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\150\215\150\215\150\215\0\0\0\0\0\0\0\0\0\0\0\0\0\0\198\153\198\153\0\0\0\0\150\215\0\0\150\215\150\215\150\215\0\0\150\215\0\0\198\153\198\153\198\153\0\0\198\153\198\153\0\0\0\0\150\215\150\215\014\170\014\170\014\170\150\215\150\215\0\0\0\0\198\153\198\153\198\153\0\0\198\153\0\0\0\0e\149\150\215\014\170\014\170\014\170\150\215e\149\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0e\149e\149\150\215\150\215\150\215e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0"
local fenceS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0I\166I\166\165\148\165\148\165\148\165\148I\166I\166I\166I\166\165\148\165\148\165\148\165\148I\166I\166I\166\165\148,\206,\206,\206,\206\165\148I\166I\166\165\148,\206,\206,\206,\206\165\148I\166\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148\201\197,\206,\206,\206,\206\201\197\165\148\165\148\201\197,\206,\206,\206,\206\201\197\165\148\165\148\165\148\201\197\201\197\201\197\201\197\165\148\165\148\165\148\165\148\201\197\201\197\201\197\201\197\165\148\165\148\165\148F\177\165\148\165\148\165\148\165\148F\177\165\148\165\148F\177\165\148\165\148\165\148\165\148F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177\201\197F\177\165\148\165\148F\177\201\197\201\197F\177\201\197F\177\165\148\165\148F\177F\177\201\197F\177\201\197F\177\165\148\165\148F\177F\177\201\197F\177\201\197F\177\165\148\165\148\165\148F\177\201\197F\177\201\197\165\148\165\148\165\148\165\148F\177\201\197F\177\201\197\165\148\165\148\231\149\165\148\165\148\165\148\165\148\165\148\165\148\231\149\231\149\165\148\165\148\165\148\165\148\165\148\165\148\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149"
local stonesS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190"
local signS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148,\206,\206\165\148\165\148\165\148\165\148\165\148\165\148\0\0\165\148,\206,\206,\206,\206,\206\165\148,\206,\206\165\148,\206,\206,\206,\206,\206\165\148\165\148,\206,\206,\206,\206,\206,\206\165\148\165\148,\206,\206,\206,\206,\206,\206\165\148\165\148,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206\165\148\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0\165\148,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206\165\148\0\0\0\0\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148,\206\165\148\0\0\0\0\165\148,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206\165\148\0\0\0\0\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148,\206\165\148\0\0\0\0\165\148,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206\165\148\0\0\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148,\206,\206\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148,\206,\206\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
local linkS = {"\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144B\170B\170B\170B\170\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\0\0\164\144B\170B\170\196\186\196\186\196\186\196\186\196\186B\170\164\144\0\0\164\144\0\0\164\144l\246\164\144\164\144B\170\196\186\196\186\196\186B\170B\170B\170B\170\164\144\164\144l\246\164\144\164\144l\246\164\144\164\144B\170\196\186B\170B\170\164\144\164\144B\170B\170B\170\164\144l\246\164\144\164\144\164\213\164\144\224\245\164\144B\170\164\144B\170B\170B\170B\170\164\144\224\245\164\144\164\213\164\144\164\144\164\213\164\213\164\144\224\245\164\144B\170\196\186\196\186\196\186\221\247B\170\164\144\164\144\164\213\164\144\164\144\164\213\164\213\164\144\164\144\224\245\164\144B\170B\170\196\186\196\186B\170\164\144\164\213\164\213\164\144\0\0\164\144\164\144\149\237\164\144\164\144\164\144\164\144B\170\196\186\196\186B\170\164\144\149\237\164\144\0\0\0\0\0\0\164\144\149\237\149\237\149\237\164\144\164\144B\170B\170\196\186\164\144\149\237\164\144\0\0\0\0\0\0\164\144d\193\164\144\149\237\149\237\149\237\164\144B\170B\170\196\186\164\144\164\144\164\144\164\144\0\0\164\144d\193d\193d\193\164\144\164\144\149\237\149\237\164\144B\170\196\186\164\144\164\144d\193d\193\164\144\164\144\164\144\164\144\164\144L\154N\163\164\144\164\144\164\144\164\144\164\144L\154\164\144d\193d\193\164\144\164\144J\238J\238\164\144L\154L\154N\163N\163N\163N\163N\163L\154\164\144d\193\164\144\0\0\164\144J\238J\238\164\144L\154L\154N\163N\163N\163N\163L\154L\154L\154\164\144\0\0\0\0\0\0\164\144\164\144H\247L\154L\154L\154L\154N\163N\163L\154L\154L\154\164\144\0\0\0\0\0\0\0\0\164\144L\154H\247H\247L\154L\154L\154H\247L\154\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144L\154L\154H\247H\247H\247L\154\164\144d\220d\220\164\144\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144L\154L\154L\154\164\144d\220d\220d\220\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144d\220\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0",
               "\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\0\0\0\0\164\144\164\144\196\186B\170B\170\164\144\0\0\0\0\0\0\0\0\164\144B\170\196\186B\170\164\144\164\144B\170\196\186\196\186B\170\224\245B\170\164\144\164\144\164\144\0\0\0\0\164\144\196\186\196\186\164\144B\170\196\186\196\186B\170B\170\224\245\224\245\164\144\149\237\149\237\164\144\0\0\164\144B\170\196\186\196\186B\170B\170B\170\224\245\224\245\224\245\224\245\164\144\149\237\149\237\164\144\0\0\0\0\164\144B\170\196\186B\170\164\144\224\245\224\245\224\245\164\144\164\144\149\237\149\237\164\144\0\0\0\0\0\0\164\144B\170B\170\164\144l\246\164\144\164\144\164\144\149\237\149\237\149\237\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144l\246\164\213\164\144\149\237\149\237\164\144\164\144\164\213\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\213\164\144\149\237\149\237\164\144\221\247\164\144l\246\164\144\0\0\0\0\0\0\0\0\164\144\149\237\164\144\164\213\164\213\164\144\164\144\164\144\221\247\164\144l\246l\246\164\144\0\0\0\0\0\0\0\0\164\144\149\237\164\144\164\213\164\213l\246l\246\164\213l\246\164\213\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\213\164\213\164\213\164\213\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144d\193d\193d\193\164\144\164\144\164\144\164\144\164\144\164\144J\238\164\144\0\0\0\0\0\0\0\0\164\144\164\144d\193d\193\164\144L\154L\154L\154L\154\164\144\164\144\0\0\0\0\0\0\0\0\164\144J\238J\238\164\144\164\144L\154L\154N\163N\163L\154\164\144\0\0\0\0\0\0\0\0\0\0\164\144J\238J\238\164\144L\154L\154N\163N\163N\163\164\144H\247\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144H\247H\247L\154N\163N\163L\154H\247L\154\164\144\164\144\0\0\0\0\0\0\164\144d\220\164\144L\154L\154H\247H\247H\247H\247L\154\164\144\164\213\224\245\164\144\0\0\0\0\0\0\164\144\164\144\164\144\164\144L\154L\154L\154L\154\164\144\164\213d\220\224\245\164\144\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144d\220d\220d\220\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
               "\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144B\170B\170\196\186B\170\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144B\170B\170\196\186\196\186\196\186\196\186B\170\164\144\0\0\0\0\0\0\0\0\164\144\0\0\164\144\164\144\224\245B\170B\170\196\186B\170\224\245\164\144B\170\164\144\164\144\0\0\164\144l\246\164\144\149\237\164\144\164\144\224\245\224\245\224\245\224\245\164\144\164\144B\170\164\144l\246\164\144\164\144l\246\164\144\149\237\149\237\149\237\164\144\164\144\164\144\164\144\149\237\149\237\164\144\164\144l\246\164\144\164\144\164\213l\246\164\144\149\237\149\237\149\237\149\237\149\237\149\237\149\237\149\237\164\144l\246\164\213\164\144\164\144\164\213\164\144\149\237\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\149\237\164\144\164\213\164\144\0\0\164\144\164\213\164\144\164\213\221\247\221\247\164\213\164\213\221\247\221\247\164\213\164\144\164\213\164\144\0\0\0\0\0\0\164\144\164\213\164\213\221\247\164\144l\246l\246\164\144\221\247\164\213\164\213\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\213l\246\164\144l\246l\246\164\144l\246\164\213\164\144\164\144\0\0\0\0\0\0\164\144d\193d\193\164\144\164\213l\246l\246l\246l\246\164\213\164\144\164\144d\193\164\144\0\0\0\0\164\144d\193d\193d\193\164\144\164\144\164\213\164\213\164\144\164\144\164\144d\193d\193\164\144\0\0\0\0\164\144d\193d\193\164\144\164\144L\154\164\144\164\144L\154N\163L\154\164\144d\193\164\144\0\0\0\0\164\144d\193\164\144J\238J\238\164\144L\154N\163N\163L\154L\154L\154\164\144\0\0\0\0\0\0\0\0\164\144\164\144J\238J\238\164\144L\154N\163L\154L\154H\247H\247\164\144\0\0\0\0\0\0\0\0\164\144L\154\164\144\164\144\164\144H\247H\247\164\144H\247L\154L\154\164\144\0\0\0\0\0\0\0\0\164\144\164\144L\154L\154H\247H\247H\247\164\144L\154\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144L\154L\154L\154L\154\164\144d\220d\220\224\245\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144d\220\164\144\164\144\164\144\164\144\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0",
               "\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144B\170B\170\196\186\164\144\164\144\0\0\0\0\164\144\164\144\164\144\0\0\0\0\164\144\164\144\164\144B\170\224\245B\170\196\186\196\186B\170\164\144\164\144B\170\196\186B\170\164\144\164\144\149\237\149\237\164\144\224\245\224\245B\170B\170\196\186\196\186B\170\164\144\196\186\196\186\164\144\0\0\164\144\149\237\149\237\164\144\224\245\224\245\224\245\224\245B\170B\170B\170\196\186\196\186B\170\164\144\0\0\0\0\164\144\149\237\149\237\164\144\164\144\224\245\224\245\224\245\164\144B\170\196\186B\170\164\144\0\0\0\0\0\0\164\144\164\144\149\237\149\237\149\237\164\144\164\144\164\144l\246\164\144B\170B\170\164\144\0\0\0\0\0\0\164\144\164\213\164\144\164\144\149\237\149\237\164\144\164\213l\246\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144l\246\164\144\221\247\164\144\149\237\149\237\164\144\164\213\164\144\164\144\0\0\0\0\0\0\0\0\164\144l\246l\246\164\144\221\247\164\144\164\144\164\144\164\213\164\213\164\144\149\237\164\144\0\0\0\0\0\0\0\0\164\144\164\213l\246\164\213l\246l\246\164\213\164\213\164\144\149\237\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\213\164\213\164\213\164\213\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144J\238\164\144\164\144\164\144\164\144\164\144\164\144d\193d\193d\193\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144L\154L\154L\154L\154\164\144d\193d\193\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\164\144L\154N\163N\163L\154L\154\164\144\164\144J\238J\238\164\144\0\0\0\0\0\0\0\0\164\144H\247\164\144N\163N\163N\163L\154L\154\164\144J\238J\238\164\144\0\0\0\0\0\0\164\144\164\144L\154H\247L\154N\163N\163L\154H\247H\247\164\144\164\144\164\144\0\0\0\0\164\144\224\245\164\213\164\144L\154H\247H\247H\247H\247L\154L\154\164\144d\220\164\144\0\0\0\0\164\144\224\245d\220\164\213\164\144L\154L\154L\154L\154\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144d\220d\220d\220\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}
local map1 = {{2,2,2,2,2,2,2,2,2,2,2,5,2,2,2},
              {2,1,1,1,1,1,1,1,1,4,3,5,3,3,2},
              {2,1,1,1,1,3,1,1,1,4,4,5,4,4,2},
              {2,3,1,5,5,5,5,5,1,1,1,5,1,1,2},
              {2,1,1,5,1,1,1,5,3,1,1,5,1,1,2},
              {2,1,1,5,1,1,1,5,1,1,1,5,1,1,2},
              {2,1,1,5,1,1,1,5,5,5,5,5,3,1,2},
              {2,1,1,5,3,1,1,1,1,1,1,1,1,1,2},
              {2,1,1,5,1,1,1,1,3,1,1,1,1,1,2},
              {2,4,4,2,4,4,1,1,1,1,1,1,3,1,2},
              {2,3,3,5,3,4,1,1,1,1,1,1,1,1,2},
              {2,2,2,5,2,2,2,2,2,2,2,2,2,2,2}}
local map2 = {{2,2,2,2,2,2},
              {2,3,1,1,1,2},
              {2,1,1,3,1,2},
              {2,1,4,1,4,2},
              {2,3,4,1,4,2},
              {2,2,2,5,2,2}}
local initialized = false
function on.paint(gc)
    if not initialized then
        coyote = Coyote(63, 26, 12, 10)
        coyote:loadTile(nil, {72, 152, 72}, true)
        local bushT = coyote:loadTile(bushS, {40, 120, 56}, false)
        coyote:loadTile(flowersS, {72, 152, 72}, true)
        coyote:loadTile(fenceS, nil, false)
        coyote:loadTile(stonesS, {160, 224, 168}, true)
        local signT = coyote:loadTile(signS, nil, false)
        local linkT = coyote:loadTile(linkS, nil, false)
        coyote:setPlayer(linkT, 2, 2, 0, -8)
        a1 = Area(coyote, map1)
        a1:newObject("sign", signT, 10, 6)
        a1:newEvent(10, 7, 1, true, signRead)
        a1:newEvent(12, 1, nil, false, a1Toa2)
        a2 = Area(coyote, map2, -3, -2)
        a2:newObject("blocking_bush", bushT, 4, 4)
        a2:newEvent(4, 6, nil, false, a2Toa1)
        coyote:setArea(a1)
        initialized = true
    end
    coyote:draw()
    gc:drawRect(62, 25, 193, 161)
end



I'll see how I can optimize it if I find some way to do that...

edit : oh well, your code really looks nice already !
« Last Edit: 25 December, 2011, 18:38:46 by adriweb » Logged


TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 16:11:27
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #2 on: 25 December, 2011, 16:05:01 »
0

Thanks a lot! Smiley
BTW, is it me or is the formatting messed up?
Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 23:44:47
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50227


Total Post Ratings: +2615

View Profile WWW
« Reply #3 on: 25 December, 2011, 16:40:37 »
0

In June 2012, you might have to change the Coyotes name to Nordiques. Tongue

Anyway joking aside, this looks nice. I will definitively have to give this a try when I have time. Will it support full screen or will it always just use a small portion of the screen due to limitations or something else?
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 16:11:27
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #4 on: 25 December, 2011, 16:51:29 »
0

Anyway joking aside, this looks nice. I will definitively have to give this a try when I have time. Will it support full screen or will it always just use a small portion of the screen due to limitations or something else?
Oh no, of course not. It's that small just to show off the scrolling (didn't bother to make a bigger map, maybe I should for the sake of a nicer demo). As I said it'll be a very flexible library, no restrictions.

EDIT: I updated the demo to a full screen one.
« Last Edit: 25 December, 2011, 17:39:00 by hoffa » Logged
adriweb
Editor
LV9 Veteran (Next: 1337)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 12:02:44
Date Registered: 13 April, 2011, 18:42:59
Location: South of France
Posts: 1197


Total Post Ratings: +185

View Profile WWW
« Reply #5 on: 25 December, 2011, 18:55:21 »
0

Cool Smiley

Also, don't use platform.gc() anymore, it won't work as much (if at all) in future versions.
Here's the same code, but using on.paint's gc :


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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
platform.apilevel = '1.0'
Coyote = class()

function Coyote:init(x, y, width, height, options)
    options = options or {}
    self.x = x
    self.y = y
    self.width = width
    self.height = height
    self.tiles = {}
    self.controls = options.controls or {up = "up",
                                         down = "down",
                                         left = "left",
                                         right = "right"}
    self.player = {}
    self.tileSize = options.tileSize or 16
    self.scrollThreshold = options.scrollThreshold or 1
    self.outOfBoundsColor = options.outOfBoundsColor or {0, 0, 0}
    self.tileCount = 0
end

function Coyote:loadTile(sprites, color, walkable)
    self.tileCount = self.tileCount + 1
    self.tiles[self.tileCount] = {}
    local tile = self.tiles[self.tileCount]
    if type(sprites) == "string" then
        tile.sprites = {image.new(sprites)}
    elseif type(sprites) == "table" then
        tile.sprites = {}
        for i = 1, #sprites do
            tile.sprites[i] = image.new(sprites[i])
        end
    end
    tile.color = color
    tile.walkable = walkable
    return self.tileCount
end

function Coyote:handleMoveKey(key)
    local direction = (key == self.controls.up and 1)
                    or (key == self.controls.right and 2)
                    or (key == self.controls.down and 3)
                    or (key == self.controls.left and 4)
    local map = self.area.map
    local player = self.player
    if direction == self.player.direction then
        local x = player.x + ((direction == 2 and 1) or (direction == 4 and -1) or 0)
        local y = player.y + ((direction == 1 and -1) or (direction == 3 and 1) or 0)
        if self.tiles[map.data[y][x]].walkable then
            local object = self.area:getObjectAt(x, y)
            if not object or self.tiles[object.tile].walkable then
                player.x = x
                player.y = y
            end
        end
        if self:processEvents() then
            return
        end
        map.x = map.x + ((player.x <= map.x + self.scrollThreshold and -1)
                         or (player.x + self.scrollThreshold > map.x + self.width and 1)
                         or 0)
        map.y = map.y + ((player.y <= map.y + self.scrollThreshold and -1)
                         or (player.y + self.scrollThreshold > map.y + self.height and 1)
                         or 0)
    end
    self.player.direction = direction
end

function Coyote:handleEventKey()
    self:processEvents(true)
end

function Coyote:processEvents(keyPressed)
    for i = 1, #self.area.events do
        local event = self.area.events[i]
        if event.x == self.player.x
        and event.y == self.player.y
        and event.keyPress == (keyPressed or false) then
            if not event.direction
            or event.direction == self.player.direction then
                event.callback()
                return true
            end
        end
    end
end

function Coyote:setPlayer(tile, x, y, offsetX, offsetY, direction)
    local player = self.player
    player.tile = tile
    player.x = x
    player.y = y
    player.offset = {x = offsetX or 0, y = offsetY or 0}
    player.direction = direction or 3
end

function Coyote:setArea(area)
    self.area = area
end

function Coyote:movePlayer(x, y)
    self.player.x = x
    self.player.y = y
end

function Coyote:relativeToAbsolutePosition(x, y)
    return ((x - self.area.map.x - 1) * self.tileSize) + self.x,
           ((y - self.area.map.y - 1) * self.tileSize) + self.y
end

function Coyote:drawTileMap(gc)
    local x = self.x
    local y = self.y
    local area = self.area
    for i = area.map.y + 1, area.map.y + self.height do
        for j = area.map.x + 1, area.map.x + self.width do
            if j > 0 and j <= area.map.width and i > 0 and i <= area.map.height
            and area.map.data[i][j] > 0 then
                local tile = self.tiles[area.map.data[i][j]]
                if tile.color then
                    gc:setColorRGB(tile.color[1], tile.color[2], tile.color[3])
                    gc:fillRect(x, y, self.tileSize, self.tileSize)
                end
                if tile.sprites then
                    gc:drawImage(tile.sprites[1], x, y)
                end
            elseif self.outOfBoundsColor then
                gc:setColorRGB(self.outOfBoundsColor[1],
                                    self.outOfBoundsColor[2],
                                    self.outOfBoundsColor[3])
                gc:fillRect(x, y, self.tileSize, self.tileSize)
            end
            x = x + self.tileSize
        end
        x = self.x
        y = y + self.tileSize
    end
end

function Coyote:drawObjects(gc)
    local map = self.area.map
    for name, object in pairs(self.area.objects) do
        if object.x > map.x and object.x <= map.x + self.width
        and object.y > map.y and object.y <= map.y + self.height then
            local x, y = self:relativeToAbsolutePosition(object.x, object.y)
            gc:drawImage(self.tiles[object.tile].sprites[object.currentSprite], x, y)
        end
    end
end

function Coyote:drawPlayer(gc)
    local x, y = self:relativeToAbsolutePosition(self.player.x, self.player.y)
    gc:drawImage(self.tiles[self.player.tile].sprites[self.player.direction],
                      x + self.player.offset.x, y + self.player.offset.y)
end

function Coyote:draw(gc)
    self:drawTileMap(gc)
    self:drawObjects(gc)
    self:drawPlayer(gc)
end

Area = class()

function Area:init(super, map, x, y)
    self.super = super
    self.map = {data = map,
                width = #map[1],
                height = #map,
                x = x or 0,
                y = y or 0}
    self.objects = {}
    self.events = {}
end

function Area:newObject(name, tile, x, y)
    self.objects[name] = {tile = tile, x = x, y = y, currentSprite = 1}
end

function Area:newEvent(x, y, direction, keyPress, callback)
    table.insert(self.events, {x = x, y = y,
                               direction = direction,
                               keyPress = keyPress,
                               callback = callback})
end

function Area:getObjectAt(x, y)
    for _, object in pairs(self.objects) do
        if object.x == x and object.y == y then
            return object
        end
    end
end

function Area:moveObject(name, x, y)
    self.objects[name].x = x
    self.objects[name].y = y
end

function Area:setObjectSprite(name, spriteNumber)
    self.objects[name].currentSprite = spriteNumber
end

function Area:destroyObject(name)
    self.objects[name] = nil
end

function a1Toa2()
    coyote:setArea(a2)
    coyote:movePlayer(4, 5)
end

function a2Toa1()
    coyote:setArea(a1)
    coyote:movePlayer(12, 2)
end

function signRead()
    a2:destroyObject("blocking_bush")
end

function on.arrowKey(key)
    coyote:handleMoveKey(key)
    platform.window:invalidate()
end

function on.enterKey()
    coyote:handleEventKey()
    platform.window:invalidate()
end

local bushS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0I\166I\166I\166\0\0\165\148\165\148\165\148\0\0\0\0\165\148\165\148\165\148\0\0I\166I\166I\166I\166I\166\0\0\165\148I\166I\166\0\0\165\148\165\148\0\0I\166I\166\165\148\0\0I\166I\166I\166\0\0\0\0\165\148I\166\0\0\0\0\165\148\165\148\0\0\0\0I\166\165\148\0\0\0\0I\166\0\0\165\148\165\148\165\148\165\148\0\0\0\0\165\148\165\148\0\0\0\0\165\148\165\148\165\148\165\148\231\149\165\148I\166I\166\0\0\0\0\165\148\165\148\0\0\0\0\165\148\165\148\0\0\0\0I\166I\166\165\148\165\148I\166\0\0\0\0\0\0\0\0\165\148I\166I\166\165\148\0\0\0\0\0\0\0\0I\166\165\148\165\148\165\148\0\0\0\0\0\0\0\0\165\148I\166I\166\165\148\0\0\0\0\0\0\0\0\165\148\165\148\0\0\165\148\165\148\165\148\165\148\165\148\165\148\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148\231\149\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\165\148I\166\0\0\0\0\0\0\165\148\165\148\0\0\0\0\165\148\165\148\0\0\0\0\0\0I\166\165\148\165\148I\166I\166\0\0\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\0\0I\166I\166\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148\0\0\165\148\165\148\0\0\0\0\165\148I\166\0\0\0\0I\166\165\148\0\0\0\0\165\148\165\148\0\0\0\0\0\0\165\148I\166\0\0\165\148\165\148I\166I\166\165\148\165\148\0\0I\166\165\148\0\0\0\0I\166\0\0\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0I\166I\166I\166\0\0\0\0\0\0\0\0\0\0\165\148\165\148\0\0\0\0\0\0\0\0\0\0I\166I\166"
local flowersS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\150\215\150\215\150\215\0\0\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\150\215\0\0\150\215\150\215\150\215\0\0\150\215\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\0\0\150\215\150\215\014\170\014\170\014\170\150\215\150\215\0\0\198\153\198\153\0\0\198\153\198\153\198\153\0\0\0\0e\149\150\215\014\170\014\170\014\170\150\215e\149\0\0\198\153\0\0\198\153\198\153\198\153\0\0\0\0\0\0e\149e\149\150\215\150\215\150\215e\149e\149\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0\0\0\150\215\150\215\150\215\0\0\0\0\0\0\0\0\0\0\0\0\0\0\198\153\198\153\0\0\0\0\150\215\0\0\150\215\150\215\150\215\0\0\150\215\0\0\198\153\198\153\198\153\0\0\198\153\198\153\0\0\0\0\150\215\150\215\014\170\014\170\014\170\150\215\150\215\0\0\0\0\198\153\198\153\198\153\0\0\198\153\0\0\0\0e\149\150\215\014\170\014\170\014\170\150\215e\149\0\0\0\0\0\0\198\153\198\153\0\0\0\0\0\0\0\0e\149e\149\150\215\150\215\150\215e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\149e\149e\149\0\0\0\0"
local fenceS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0I\166I\166\165\148\165\148\165\148\165\148I\166I\166I\166I\166\165\148\165\148\165\148\165\148I\166I\166I\166\165\148,\206,\206,\206,\206\165\148I\166I\166\165\148,\206,\206,\206,\206\165\148I\166\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206\201\197,\206,\206\201\197,\206\165\148\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148,\206,\206\201\197\201\197,\206,\206\165\148\165\148\201\197,\206,\206,\206,\206\201\197\165\148\165\148\201\197,\206,\206,\206,\206\201\197\165\148\165\148\165\148\201\197\201\197\201\197\201\197\165\148\165\148\165\148\165\148\201\197\201\197\201\197\201\197\165\148\165\148\165\148F\177\165\148\165\148\165\148\165\148F\177\165\148\165\148F\177\165\148\165\148\165\148\165\148F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177F\177F\177\165\148\165\148F\177\201\197\201\197F\177\201\197F\177\165\148\165\148F\177\201\197\201\197F\177\201\197F\177\165\148\165\148F\177F\177\201\197F\177\201\197F\177\165\148\165\148F\177F\177\201\197F\177\201\197F\177\165\148\165\148\165\148F\177\201\197F\177\201\197\165\148\165\148\165\148\165\148F\177\201\197F\177\201\197\165\148\165\148\231\149\165\148\165\148\165\148\165\148\165\148\165\148\231\149\231\149\165\148\165\148\165\148\165\148\165\148\165\148\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149\231\149"
local stonesS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\0\0\0\0\0\0\0\0\0\0\0\0\0\0\210\190\210\190\0\0\0\0\210\190\0\0\0\0\210\190\210\190\210\190\0\0\0\0\0\0\0\0\0\0\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190\210\190"
local signS = "\016\0\0\0\016\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148,\206,\206\165\148\165\148\165\148\165\148\165\148\165\148\0\0\165\148,\206,\206,\206,\206,\206\165\148,\206,\206\165\148,\206,\206,\206,\206,\206\165\148\165\148,\206,\206,\206,\206,\206,\206\165\148\165\148,\206,\206,\206,\206,\206,\206\165\148\165\148,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206\165\148\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0\165\148,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206\165\148\0\0\0\0\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148,\206\165\148\0\0\0\0\165\148,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206,\206\165\148,\206\165\148\0\0\0\0\165\148,\206\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148,\206\165\148\0\0\0\0\165\148,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206,\206\165\148\0\0\0\0\0\0\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148,\206,\206\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148,\206,\206\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\165\148\165\148\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
local linkS = {"\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144B\170B\170B\170B\170\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\0\0\164\144B\170B\170\196\186\196\186\196\186\196\186\196\186B\170\164\144\0\0\164\144\0\0\164\144l\246\164\144\164\144B\170\196\186\196\186\196\186B\170B\170B\170B\170\164\144\164\144l\246\164\144\164\144l\246\164\144\164\144B\170\196\186B\170B\170\164\144\164\144B\170B\170B\170\164\144l\246\164\144\164\144\164\213\164\144\224\245\164\144B\170\164\144B\170B\170B\170B\170\164\144\224\245\164\144\164\213\164\144\164\144\164\213\164\213\164\144\224\245\164\144B\170\196\186\196\186\196\186\221\247B\170\164\144\164\144\164\213\164\144\164\144\164\213\164\213\164\144\164\144\224\245\164\144B\170B\170\196\186\196\186B\170\164\144\164\213\164\213\164\144\0\0\164\144\164\144\149\237\164\144\164\144\164\144\164\144B\170\196\186\196\186B\170\164\144\149\237\164\144\0\0\0\0\0\0\164\144\149\237\149\237\149\237\164\144\164\144B\170B\170\196\186\164\144\149\237\164\144\0\0\0\0\0\0\164\144d\193\164\144\149\237\149\237\149\237\164\144B\170B\170\196\186\164\144\164\144\164\144\164\144\0\0\164\144d\193d\193d\193\164\144\164\144\149\237\149\237\164\144B\170\196\186\164\144\164\144d\193d\193\164\144\164\144\164\144\164\144\164\144L\154N\163\164\144\164\144\164\144\164\144\164\144L\154\164\144d\193d\193\164\144\164\144J\238J\238\164\144L\154L\154N\163N\163N\163N\163N\163L\154\164\144d\193\164\144\0\0\164\144J\238J\238\164\144L\154L\154N\163N\163N\163N\163L\154L\154L\154\164\144\0\0\0\0\0\0\164\144\164\144H\247L\154L\154L\154L\154N\163N\163L\154L\154L\154\164\144\0\0\0\0\0\0\0\0\164\144L\154H\247H\247L\154L\154L\154H\247L\154\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144L\154L\154H\247H\247H\247L\154\164\144d\220d\220\164\144\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144L\154L\154L\154\164\144d\220d\220d\220\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144d\220\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0",
               "\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\0\0\0\0\164\144\164\144\196\186B\170B\170\164\144\0\0\0\0\0\0\0\0\164\144B\170\196\186B\170\164\144\164\144B\170\196\186\196\186B\170\224\245B\170\164\144\164\144\164\144\0\0\0\0\164\144\196\186\196\186\164\144B\170\196\186\196\186B\170B\170\224\245\224\245\164\144\149\237\149\237\164\144\0\0\164\144B\170\196\186\196\186B\170B\170B\170\224\245\224\245\224\245\224\245\164\144\149\237\149\237\164\144\0\0\0\0\164\144B\170\196\186B\170\164\144\224\245\224\245\224\245\164\144\164\144\149\237\149\237\164\144\0\0\0\0\0\0\164\144B\170B\170\164\144l\246\164\144\164\144\164\144\149\237\149\237\149\237\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144l\246\164\213\164\144\149\237\149\237\164\144\164\144\164\213\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\213\164\144\149\237\149\237\164\144\221\247\164\144l\246\164\144\0\0\0\0\0\0\0\0\164\144\149\237\164\144\164\213\164\213\164\144\164\144\164\144\221\247\164\144l\246l\246\164\144\0\0\0\0\0\0\0\0\164\144\149\237\164\144\164\213\164\213l\246l\246\164\213l\246\164\213\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\213\164\213\164\213\164\213\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144d\193d\193d\193\164\144\164\144\164\144\164\144\164\144\164\144J\238\164\144\0\0\0\0\0\0\0\0\164\144\164\144d\193d\193\164\144L\154L\154L\154L\154\164\144\164\144\0\0\0\0\0\0\0\0\164\144J\238J\238\164\144\164\144L\154L\154N\163N\163L\154\164\144\0\0\0\0\0\0\0\0\0\0\164\144J\238J\238\164\144L\154L\154N\163N\163N\163\164\144H\247\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144H\247H\247L\154N\163N\163L\154H\247L\154\164\144\164\144\0\0\0\0\0\0\164\144d\220\164\144L\154L\154H\247H\247H\247H\247L\154\164\144\164\213\224\245\164\144\0\0\0\0\0\0\164\144\164\144\164\144\164\144L\154L\154L\154L\154\164\144\164\213d\220\224\245\164\144\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144d\220d\220d\220\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
               "\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144B\170B\170\196\186B\170\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144B\170B\170\196\186\196\186\196\186\196\186B\170\164\144\0\0\0\0\0\0\0\0\164\144\0\0\164\144\164\144\224\245B\170B\170\196\186B\170\224\245\164\144B\170\164\144\164\144\0\0\164\144l\246\164\144\149\237\164\144\164\144\224\245\224\245\224\245\224\245\164\144\164\144B\170\164\144l\246\164\144\164\144l\246\164\144\149\237\149\237\149\237\164\144\164\144\164\144\164\144\149\237\149\237\164\144\164\144l\246\164\144\164\144\164\213l\246\164\144\149\237\149\237\149\237\149\237\149\237\149\237\149\237\149\237\164\144l\246\164\213\164\144\164\144\164\213\164\144\149\237\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\149\237\164\144\164\213\164\144\0\0\164\144\164\213\164\144\164\213\221\247\221\247\164\213\164\213\221\247\221\247\164\213\164\144\164\213\164\144\0\0\0\0\0\0\164\144\164\213\164\213\221\247\164\144l\246l\246\164\144\221\247\164\213\164\213\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\213l\246\164\144l\246l\246\164\144l\246\164\213\164\144\164\144\0\0\0\0\0\0\164\144d\193d\193\164\144\164\213l\246l\246l\246l\246\164\213\164\144\164\144d\193\164\144\0\0\0\0\164\144d\193d\193d\193\164\144\164\144\164\213\164\213\164\144\164\144\164\144d\193d\193\164\144\0\0\0\0\164\144d\193d\193\164\144\164\144L\154\164\144\164\144L\154N\163L\154\164\144d\193\164\144\0\0\0\0\164\144d\193\164\144J\238J\238\164\144L\154N\163N\163L\154L\154L\154\164\144\0\0\0\0\0\0\0\0\164\144\164\144J\238J\238\164\144L\154N\163L\154L\154H\247H\247\164\144\0\0\0\0\0\0\0\0\164\144L\154\164\144\164\144\164\144H\247H\247\164\144H\247L\154L\154\164\144\0\0\0\0\0\0\0\0\164\144\164\144L\154L\154H\247H\247H\247\164\144L\154\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144L\154L\154L\154L\154\164\144d\220d\220\224\245\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144d\220\164\144\164\144\164\144\164\144\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0",
               "\016\0\0\0\024\0\0\0\0\0\0\0 \0\0\0\016\0\001\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144B\170B\170\196\186\164\144\164\144\0\0\0\0\164\144\164\144\164\144\0\0\0\0\164\144\164\144\164\144B\170\224\245B\170\196\186\196\186B\170\164\144\164\144B\170\196\186B\170\164\144\164\144\149\237\149\237\164\144\224\245\224\245B\170B\170\196\186\196\186B\170\164\144\196\186\196\186\164\144\0\0\164\144\149\237\149\237\164\144\224\245\224\245\224\245\224\245B\170B\170B\170\196\186\196\186B\170\164\144\0\0\0\0\164\144\149\237\149\237\164\144\164\144\224\245\224\245\224\245\164\144B\170\196\186B\170\164\144\0\0\0\0\0\0\164\144\164\144\149\237\149\237\149\237\164\144\164\144\164\144l\246\164\144B\170B\170\164\144\0\0\0\0\0\0\164\144\164\213\164\144\164\144\149\237\149\237\164\144\164\213l\246\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144l\246\164\144\221\247\164\144\149\237\149\237\164\144\164\213\164\144\164\144\0\0\0\0\0\0\0\0\164\144l\246l\246\164\144\221\247\164\144\164\144\164\144\164\213\164\213\164\144\149\237\164\144\0\0\0\0\0\0\0\0\164\144\164\213l\246\164\213l\246l\246\164\213\164\213\164\144\149\237\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\213\164\213\164\213\164\213\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144J\238\164\144\164\144\164\144\164\144\164\144\164\144d\193d\193d\193\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144L\154L\154L\154L\154\164\144d\193d\193\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\164\144L\154N\163N\163L\154L\154\164\144\164\144J\238J\238\164\144\0\0\0\0\0\0\0\0\164\144H\247\164\144N\163N\163N\163L\154L\154\164\144J\238J\238\164\144\0\0\0\0\0\0\164\144\164\144L\154H\247L\154N\163N\163L\154H\247H\247\164\144\164\144\164\144\0\0\0\0\164\144\224\245\164\213\164\144L\154H\247H\247H\247H\247L\154L\154\164\144d\220\164\144\0\0\0\0\164\144\224\245d\220\164\213\164\144L\154L\154L\154L\154\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144d\220d\220d\220\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\164\144\164\144\164\144\164\144\164\144\164\144\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}
local map1 = {{2,2,2,2,2,2,2,2,2,2,2,5,2,2,2},
              {2,1,1,1,1,1,1,1,1,4,3,5,3,3,2},
              {2,1,1,1,1,3,1,1,1,4,4,5,4,4,2},
              {2,3,1,5,5,5,5,5,1,1,1,5,1,1,2},
              {2,1,1,5,1,1,1,5,3,1,1,5,1,1,2},
              {2,1,1,5,1,1,1,5,1,1,1,5,1,1,2},
              {2,1,1,5,1,1,1,5,5,5,5,5,3,1,2},
              {2,1,1,5,3,1,1,1,1,1,1,1,1,1,2},
              {2,1,1,5,1,1,1,1,3,1,1,1,1,1,2},
              {2,4,4,2,4,4,1,1,1,1,1,1,3,1,2},
              {2,3,3,5,3,4,1,1,1,1,1,1,1,1,2},
              {2,2,2,5,2,2,2,2,2,2,2,2,2,2,2}}
local map2 = {{2,2,2,2,2,2},
              {2,3,1,1,1,2},
              {2,1,1,3,1,2},
              {2,1,4,1,4,2},
              {2,3,4,1,4,2},
              {2,2,2,5,2,2}}
local initialized = false
function on.paint(gc)
    if not initialized then
        coyote = Coyote(63, 26, 12, 10)
        coyote:loadTile(nil, {72, 152, 72}, true)
        local bushT = coyote:loadTile(bushS, {40, 120, 56}, false)
        coyote:loadTile(flowersS, {72, 152, 72}, true)
        coyote:loadTile(fenceS, nil, false)
        coyote:loadTile(stonesS, {160, 224, 168}, true)
        local signT = coyote:loadTile(signS, nil, false)
        local linkT = coyote:loadTile(linkS, nil, false)
        coyote:setPlayer(linkT, 2, 2, 0, -8)
        a1 = Area(coyote, map1)
        a1:newObject("sign", signT, 10, 6)
        a1:newEvent(10, 7, 1, true, signRead)
        a1:newEvent(12, 1, nil, false, a1Toa2)
        a2 = Area(coyote, map2, -3, -2)
        a2:newObject("blocking_bush", bushT, 4, 4)
        a2:newEvent(4, 6, nil, false, a2Toa1)
        coyote:setArea(a1)
        initialized = true
    end
    coyote:draw(gc)
    gc:drawRect(62, 25, 193, 161)
end
Logged


TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 23:16:13
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 766

Total Post Ratings: +151

View Profile
« Reply #6 on: 25 December, 2011, 22:50:29 »
0

Good idea hoffa Smiley
Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
yunhua98
You won't this read sentence right.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 14 May, 2012, 03:06:37
Date Registered: 26 May, 2010, 22:58:45
Location: Somewhere in Deep Space.
Posts: 2717


Total Post Ratings: +199

View Profile
« Reply #7 on: 26 December, 2011, 01:45:11 »
0

Wow.  I will definitely use this at some point.  Shocked
Logged


Spoiler for =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.

On hold for Contest.


Spoiler for ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11

cyanophycean314
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 19:28:34
Date Registered: 07 December, 2011, 02:44:32
Location: Somewhere?
Posts: 363


Total Post Ratings: +42

View Profile
« Reply #8 on: 03 January, 2012, 00:56:54 »
0

I'm getting a 404 when trying to access the source.  Sad

Are those versions of source posted by adriweb the full source and most up to date?

Nice job though  Cheesy
Logged

apcalc
The Game
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 19 May, 2013, 16:59:33
Date Registered: 20 March, 2010, 16:31:47
Location: 2003 UB313
Posts: 1393


Total Post Ratings: +118

View Profile
« Reply #9 on: 03 January, 2012, 01:26:01 »
0

Looks nice!  Excellent work!
Logged


adriweb
Editor
LV9 Veteran (Next: 1337)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 12:02:44
Date Registered: 13 April, 2011, 18:42:59
Location: South of France
Posts: 1197


Total Post Ratings: +185

View Profile WWW
« Reply #10 on: 03 January, 2012, 02:02:22 »
0

It looks like his project is now named "Owl" :

https://github.com/Hoffa/Owl
Logged


TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 16:11:27
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #11 on: 03 January, 2012, 02:34:30 »
0

It looks like his project is now named "Owl" :

https://github.com/Hoffa/Owl
It indeed is, haven't had the time to edit the thread, I'm working rather silently so I can get the most important things up. It'll also have a website and I'll use LuaDoc for the documentation.
Screenshot:
Spoiler for Hidden:
Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 23:44:47
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50227


Total Post Ratings: +2615

View Profile WWW
« Reply #12 on: 03 January, 2012, 02:44:05 »
0

Looks quite nice so far. By the way although smooth scrolling cannot be implemented, have you tried 8 pixel scrolling or even 4 pixel scrolling?
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 16:11:27
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #13 on: 03 January, 2012, 02:47:21 »
0

Looks quite nice so far. By the way although smooth scrolling cannot be implemented, have you tried 8 pixel scrolling or even 4 pixel scrolling?
No but I have tried some sort of smooth scrolling in the past. Way too slow for what it gives back, not worth the pain of implementing it. Well, at least not a this point, maybe if Lua gets a bit faster in the future, then why not.
Logged
cyanophycean314
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 19:28:34
Date Registered: 07 December, 2011, 02:44:32
Location: Somewhere?
Posts: 363


Total Post Ratings: +42

View Profile
« Reply #14 on: 03 January, 2012, 04:21:36 »
0

Okay. Thanks!
Logged

Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.328 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.