This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Adriweb
Pages: 1 ... 86 87 [88] 89 90 ... 115
1306
« on: December 26, 2011, 12:01:55 pm »
O_O
1307
« on: December 26, 2011, 05:20:36 am »
I like the new features. I didn't try this yet but I should really do so, soon. I haven't read the thread yet but I am curious how the sprite saving/exporting (if any exporting) works? Is it possible to create sprites for use in other tns files? I don't recall the Nspire having any form of external file like on the 83+.
Actually when you copy/paste things, it stays in memory even when you close the current document. So you can put something from a doc to another that way. But anyway, there is another way that consists into saving a var in a public document stored in the MyLib folder, because this one can be accessed "dynamically" whenever and from wherever you want, so this is good for sharing stuff between docs. This is the technique we'll use in EEPro. (for loading user-made custom formula databases)
1308
« on: December 26, 2011, 05:17:36 am »
Hey, guys, I want to know something. I can't figure out how to draw things, so I found the smallest image of a spacefighter on google images that I could. I used ti-nspire scripting tools to convert it to a TI-Image. Nick, I tried using your script(The script you gave me is correct). But, when I defined the picture "spacefighter" as the TI-Image string, and then ran the script in nspire student software, the title screen shows, but after I press enter, the picture doesn't show. I didn't get an error message, so I obviously typed valid program syntaxes and arguments.
your picture = image.new("....") has to be put at the very end of your program, for example, not in any functions. your gc:drawImage(picture,x,y) has to be put in the on.paint(gc) function (or any other function where gc is passed) Then, each time the screen gets refreshed, on.paint(gc) will draw your image.
1309
« on: December 26, 2011, 05:14:33 am »
When I was making a mini-shooter, I didn't know how to make multiple bullets. Each bullet is an object, but how would you implement that?
I see that you clearly have multiple bullets. Nice job!
The same way I did with multiple balls in BreakOut. If you do everything object-oriented (lua's "Class()" things) it's really easy.
1310
« on: December 26, 2011, 05:08:25 am »
It seems like it was made just so there's a Tetris game available on the CX, without worrying about quality. At that time, it rather was to demonstrate the poure possibilities. Good graphics were not the main point. This was something they know it can be done. They were focusing more on the 'algorithm' behind it and user interactino with keypresses etc., as a demo Well, that's what I think
1311
« on: December 26, 2011, 05:00:39 am »
w00t
1312
« on: December 25, 2011, 11:55:21 am »
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 : 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
1313
« on: December 25, 2011, 08:33:01 am »
Awesome ! I'll take a close look Here's the source code (extracted with the sdk ... ) (and optimized images (replaced \000 with \0 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 !
1314
« on: December 25, 2011, 05:40:44 am »
Some of TI-Planet stuff even appear on Omnimaga's blog feed thing I don't know why
1315
« on: December 24, 2011, 05:00:26 am »
Looking great However, it does look slow (is it the GIF, maybe ? ) How are your functions managed with on.timer ? (period == ?) What are you redrawing on each on.paint call ?
1316
« on: December 23, 2011, 12:52:44 pm »
Taylor it (oh, well, bsl actually wrote directly an approximation...)
1317
« on: December 23, 2011, 07:25:07 am »
I updated the archive yesterday on TI-Planet, fixing the full screen bug (computer view) and some translations mistakes (thanks to WireKey for the help )
1318
« on: December 23, 2011, 04:57:46 am »
Yeah, there still are some weird bugs and strange behaviors that need to be fixed before release
1319
« on: December 22, 2011, 01:29:38 pm »
Chokosta -> When are you going to upload it on TI-Planet ?
Pages: 1 ... 86 87 [88] 89 90 ... 115
|