Skip to content

Instantly share code, notes, and snippets.

View KaffeDiem's full-sized avatar

Kasper KaffeDiem

  • Copenhagen, Denmark
View GitHub Profile
@KaffeDiem
KaffeDiem / tiles.lua
Created March 25, 2021 14:42
Isometric Tiles in Lua
-- Drawing the map as isometric tiles
self.tilesHovered = {} -- Reset the tilesHovered table every frame
for i = 1, #self.map do -- Loop trough rows
for j = 1, #self.map[i] do -- Loop through cols in the rows
if self.map[i][j] ~= 0 then -- If there is a tile to draw
local x =
self.x + -- Starting point
(j * ((self.tileWidth / 2) * self.scale)) - -- The width on rows
(i * ((self.tileWidth / 2) * self.scale)) -- The width on cols