Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renamed geometry to world

  • Loading branch information...
commit ba9d645051ade7ec4a06e53e15a992d8cd693682 1 parent cf27c75
@kikito authored
Showing with 0 additions and 67 deletions.
  1. +0 −39 geometry/map.lua
  2. +0 −19 geometry/tile.lua
  3. +0 −9 geometry/tiles/grass.lua
View
39 geometry/map.lua
@@ -1,39 +0,0 @@
-local Grass = require('geometry.tiles.grass')
-
-local Map = class('Map')
-
-local tileWidth, tileHeight = 32, 32
-
-function Map:initialize(width, height)
- self.width = width
- self.height = height
- self.tiles = {}
- for x=1,width do
- self.tiles[x]={}
- for y=1,height do
- self.tiles[x][y] = Grass:new(self:toWorld(x,y))
- end
- end
-end
-
-function Map:draw(minx, miny, width, height)
- minx, miny = minx or 1, miny or 1
- width, height = width or self.width, height or self.height
-
- for x=minx, minx+width-1 do
- for y=miny, miny+height-1 do
- self.tiles[x][y]:draw()
- end
- end
-end
-
-function Map:toWorld(x,y)
- return (x-1)*tileWidth, (y-1)*tileHeight
-end
-
-local floor = math.floor
-function Map:getContainingCell(wx, wy)
- return floor(wx/tileWidth)+1, floor(wy/tileHeight)+1
-end
-
-return Map
View
19 geometry/tile.lua
@@ -1,19 +0,0 @@
-local anim8 = require 'lib.anim8'
-local Game = require 'game'
-
-local Tile = class('Tile')
-
-local grid = anim8.newGrid(32, 32, 1024, 1024)
-
-function Tile:initialize(quadX, quadY, x,y)
- self.image = Game.media.images.tiles
- self.quad = grid(quadX, quadY)[1]
- self.x = x
- self.y = y
-end
-
-function Tile:draw()
- love.graphics.drawq(self.image, self.quad, self.x, self.y)
-end
-
-return Tile
View
9 geometry/tiles/grass.lua
@@ -1,9 +0,0 @@
-local Tile = require 'geometry.tile'
-
-local Grass = class('Grass', Tile)
-
-function Grass:initialize(x,y)
- Tile.initialize(self, 1,1, x,y)
-end
-
-return Grass
Please sign in to comment.
Something went wrong with that request. Please try again.