Author Topic: Owl — A fast, lightweight, and flexible game engine for the TI-Nspire  (Read 12858 times)

0 Members and 1 Guest are viewing this topic.

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
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: March 09, 2012, 05:53:41 am by hoffa »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Awesome !

I'll take a close look :D

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

Code: [Select]
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: December 25, 2011, 11:38:46 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Thanks a lot! :)
BTW, is it me or is the formatting messed up?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
In June 2012, you might have to change the Coyotes name to Nordiques. :P

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?

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
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: December 25, 2011, 10:39:00 am by hoffa »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Cool :)

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 :

Code: [Select]
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
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Good idea hoffa :)
Ndless.me with the finest TI-Nspire programs

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Wow.  I will definitely use this at some point.  :o

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
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
<hr>

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
I'm getting a 404 when trying to access the source.  :(

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

Nice job though  :D

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Looks nice!  Excellent work!


Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
It looks like his project is now named "Owl" :

https://github.com/Hoffa/Owl
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
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 Spoiler:

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
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?

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
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.

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Okay. Thanks!