-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate1.p8
119 lines (100 loc) · 3.5 KB
/
template1.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
pico-8 cartridge // http://www.pico-8.com
version 27
__lua__
-- boilerplate template
-- by apa64
-- version: 1.0
--[[ MIT License
Copyright (c) 2020 Antti Ollilainen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]
-- consts
b = {
left = 0, -- ⬅️
right = 1, -- ➡️
up = 2, -- ⬆️
down = 3, -- ⬇️
fire1 = 4, -- 🅾️
fire2 = 5 -- ❎
}
c = {
black = 0,
dark_blue = 1,
dark_purple = 2,
dark_green = 3,
brown = 4,
dark_gray = 5,
light_gray = 6,
white = 7,
red = 8,
orange = 9,
yellow = 10,
green = 11,
blue = 12,
indigo = 13,
pink = 14,
peach = 15
}
palsorted = { 0, 5, 6, 7, 15, 14, 8, 2, 4, 9, 10, 11, 3, 12, 13, 1 }
-- define sprites here - note: probably not for oop
sprites = {}
-- sprites.sprite_name = 0
-- define sounds here - note: probably not for oop
sounds = {}
-- sounds.sound_name = 0
function _init() menu_init() end
function menu_init()
_update = menu_update
_draw = menu_draw
end
function menu_update()
if (btnp(b.fire1)) game_init() -- change state to play the game
end
function menu_draw()
print("menu! ", c.green) -- menu draw code
end
-->8
-- ######################## game
function game_init()
_update = game_update
_draw = game_draw
end
function game_update()
if (btnp(b.fire1)) gameover_init() -- change state to game over
end
function game_draw()
print("game! "..t(), c.yellow) -- game draw code
end
-->8
-- ################### game over
function gameover_init()
_update = gameover_update
_draw = gameover_draw
end
function gameover_update()
if (btnp(b.fire1)) menu_init() -- change state to back to menu
end
function gameover_draw()
print("game over! ", c.red) -- game over code
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000