candidate conversion to csv for level format

This commit is contained in:
Kistaro Windrider 2023-12-20 11:48:08 -08:00
parent fd391ff3bc
commit 38a054dec1
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -118,7 +118,7 @@ function _init()
init_blip_pals() init_blip_pals()
wipe_level() wipe_level()
primary_ship.main_gun = zap_gun.new() primary_ship.main_gun = zap_gun.new()
load_level(example_level) load_level(example_level_csv)
state = game state = game
pal(2,129) pal(2,129)
pal() pal()
@ -860,7 +860,8 @@ function load_level(levelfile)
leveldone = false leveldone = false
current_level = {} current_level = {}
local found_eol = false local found_eol = false
for row in all(csv(levelfile)) do if (type(levelfile)=="string") levelfile = csv(levelfile)
for row in all(levelfile) do
local x = current_level[row[1]] local x = current_level[row[1]]
if row[2] == "eol" then if row[2] == "eol" then
found_eol = true found_eol = true
@ -1062,51 +1063,33 @@ end
-- each row of level csv is offset,event,event-args... -- each row of level csv is offset,event,event-args...
-- where offset,eol is a special case. -- where offset,eol is a special case.
example_level = { example_level_csv=[[1,spawn_frownie
[1]=spawn_frownie, 60,spawn_bonus_vulcan_chasey
[60]=spawn_bonus_vulcan_chasey, 61,spawn_blocky
[61]=spawn_blocky, 85,spawn_spewy
[85]=spawn_spewy, 100,spawn_spewy
[100]=spawn_spewy, 115,spawn_spewy
[115]=spawn_spewy, 130,spawn_bonus_frownie
[130]=spawn_bonus_frownie, 145,spawn_spewy
[145]=spawn_spewy, 200,spawn_chasey
[200]=spawn_chasey, 250,spawn_blocking_blocky
[250]=spawn_blocking_blocky, 285,spawn_spec_gun_at,35,-11,blast_gun
[285]=function() 310,spawn_blocking_blocky
spawn_spec_gun_at(35, -11, blast_gun) 310,spawn_blocking_blocky
end, 310,spawn_blocking_blocky
[310]=function() 311,spawn_frownie
spawn_blocking_blocky() 350,spawn_main_gun_at,70,-11,protron_gun
spawn_blocking_blocky() 401,spawn_frownie
spawn_blocking_blocky() 420,spawn_blocking_frownie
end, 430,spawn_bonus_vulcan_chasey
[311]=spawn_frownie, 450,spawn_frownie
[350]=function() 465,spawn_bonus_frownie
spawn_main_gun_at(70, -11, protron_gun) 480,spawn_chasey
end, 500,multi,20,12,spawn_blocking_blocky
[401]=spawn_frownie, 501,spawn_bonus_frownie
[420]=spawn_blocking_frownie, 620,spawn_blocking_blocky
[430]=spawn_bonus_vulcan_chasey, 700,spawn_blocking_boss_chasey
[450]=spawn_frownie, 701,eol]]
[465]=spawn_bonus_frownie,
[480]=spawn_chasey,
[500]=function()
local tnext = lframe
local remain = 20
events:push_back{move=function()
if (lframe < tnext) return false
spawn_blocking_blocky()
tnext = lframe + 0x0.000c
remain -= 1
return (remain <= 0)
end}
end,
[501]=spawn_bonus_frownie,
[620]=spawn_blocking_blocky,
[700]=spawn_blocking_boss_chasey,
[701]=eol
}
-->8 -->8
-- bullet and gun behaviors -- bullet and gun behaviors