-
Notifications
You must be signed in to change notification settings - Fork 0
/
metacart.p8
79 lines (67 loc) · 2.06 KB
/
metacart.p8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
pico-8 cartridge // http://www.pico-8.com
version 27
__lua__
-- metacart character manager
-- by @cameron
function _init()
-- define a dictionary
dict = {"light", "dark", "fire", "water", "earth", "air", "life", "death"}
-- define a character based on the dict
character = {}
character["name"] = "bob"
for i = 1,#dict do
character[dict[i]] = true
end
char_init()
end
-->8
-- character show and select
function char_init()
_update = char_update
_draw = char_draw
end
function char_update()
if btnp(❎) then
export_init()
end
end
function char_draw()
cls()
for k,v in pairs(character) do
if k != "name" then
print(k..": "..tostr(v))
end
end
print("❎ to export "..character["name"]..".")
end
-->8
-- character export
function export_init()
_update = export_update
_draw = export_draw
file = "character"
-- export character for #include
-- init a new character file
printh('character={}', file, true)
printh('character["name"] = "'.. character["name"]..'"', file, false)
for k,v in pairs(character) do
if k != "name" then
printh('character["'..k..'"] = '..tostr(v), file, false)
end
end
status = "success"
end
function export_update()
if btnp(❎) then stop() end
end
function export_draw()
cls()
print(status.."\n❎ to end,\nthen type folder to see file")
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000