From 25b0d8533e83f41bafef5f0da09e9af62c1e7235 Mon Sep 17 00:00:00 2001 From: annabunches Date: Fri, 6 Oct 2023 19:42:22 -0400 Subject: [PATCH] Start implementing I/O for level data. --- src/wave.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wave.lua b/src/wave.lua index ffe2721..59aaee9 100644 --- a/src/wave.lua +++ b/src/wave.lua @@ -4,13 +4,24 @@ import "CoreLibs/object" import "entity" +local yaml = import "lib/lyaml" local gfx = playdate.graphics local geom = playdate.geometry class("Wave").extends() -function Wave.new() +-- returns a new Wave by loading in and parsing the wave data at path +function Wave.new(path) local w = Wave() + + local file = io.open(path) + if not file then return nil end + local data = yaml.load(file.read("*a")) + + for e in data.entities do + -- tk + end + return w end