diff --git a/ReadMe.md b/ReadMe.md index 9019c6c..fef0250 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -4,6 +4,8 @@ Strange motion. Idle toy inspired by Progress Quest. WARNING: Opens a console to LAN which can run *any* code as the user Love2D is running as! There is no security on this. +Tileset from [OpenGameArt.org](https://opengameart.org/content/dungeon-crawl-32x32-tiles). + ## Brainstroming Name the Race. Motto. Level Class (xp bar) diff --git a/assets/images.json b/assets/images.json new file mode 100644 index 0000000..70a8274 --- /dev/null +++ b/assets/images.json @@ -0,0 +1,6 @@ +{ + "grass":{ + "x":56, + "y":15 + } +} diff --git a/assets/tileset.png b/assets/tileset.png new file mode 100644 index 0000000..42c08fc Binary files /dev/null and b/assets/tileset.png differ diff --git a/src/data/constants.lua b/src/data/constants.lua index dac3fbe..9b646ea 100644 --- a/src/data/constants.lua +++ b/src/data/constants.lua @@ -3,6 +3,7 @@ local utility = require "lib.utility" local constants = { progress_bar_height = 30, reading_time_multiplier = 1 / 9, + tile_size = 32, } constants.fix_stats_tasks = function(data) diff --git a/src/data/images.lua b/src/data/images.lua new file mode 100644 index 0000000..c297f1a --- /dev/null +++ b/src/data/images.lua @@ -0,0 +1,21 @@ +local constants = require "data.constants" +local utility = require "lib.utility" + +local file = io.open("./assets/tileset.png", "rb") +local raw_data = file:read("*all") +file:close() + +local file_data = love.filesystem.newFileData(raw_data, "./assets/tileset.png") +local love_image = love.graphics.newImage(file_data) + +local tile_data = utility.load_data("./assets/images.json") + +local images = { + love_image = love_image, +} + +for name, data in pairs(tile_data) do + images[name] = love.graphics.newQuad( (data.x - 1) * constants.tile_size, (data.y - 1) * constants.tile_size, constants.tile_size, constants.tile_size, love_image ) +end + +return images diff --git a/src/main.lua b/src/main.lua index e7ce28e..649baf4 100644 --- a/src/main.lua +++ b/src/main.lua @@ -17,6 +17,7 @@ log{ local constants = require "data.constants" local classes = require "data.classes" +local images = require "data.images" local races = require "data.races" @@ -156,6 +157,7 @@ love.update = function(dt) end love.draw = function() + love.graphics.draw(images.love_image, images.grass, 50, 50) -- TEMP test_bar:draw() book_progress:draw()