Created
October 12, 2023 16:51
-
-
Save sroccaserra/3f9d40d2de47a00d71003cc4ad99abc3 to your computer and use it in GitHub Desktop.
Préparation Instant Coding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pico-8 cartridge // http://www.pico-8.com | |
version 41 | |
__lua__ | |
local ground_y = 80 | |
function _init() | |
init_mob() | |
end | |
function _draw() | |
cls() | |
map() | |
draw_mob() | |
end | |
function _update60() | |
if btn(1) then | |
➡️() | |
end | |
if btn(0) then | |
⬅️() | |
end | |
if btn(4) and is_on_ground() then | |
jump() | |
end | |
apply_gravity() | |
if is_on_ground() then | |
land() | |
end | |
end | |
-->8 | |
-- mob | |
local right = {} | |
local left = {} | |
local r = 8 | |
local x | |
local y | |
local dy | |
local direction | |
function init_mob() | |
x = 0 | |
y = 0 | |
dy = 0 | |
direction = right | |
end | |
function draw_mob() | |
spr(16, x, y-r, 1,1, is_⬅️()) | |
end | |
function is_⬅️() | |
return direction == left | |
end | |
function ➡️() | |
x = x + 1 | |
direction = right | |
end | |
function ⬅️() | |
x = x - 1 | |
direction = left | |
end | |
-->8 | |
-- physics | |
function jump() | |
dy = -1 | |
end | |
function apply_gravity() | |
y = y + dy | |
dy = dy + 0.08 | |
end | |
function is_on_ground() | |
return y >= ground_y | |
end | |
function land() | |
y = ground_y | |
dy = 0 | |
end | |
__gfx__ | |
0000000099999999dddddddddddddddddddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
000000009aaaaaaadddddddddddddddddddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
007007009aaaaaaadddddddddddddddddddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
000770009aaaaaaadddd55dddddddddddddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0007700099999999ddd5dd6dddddddddddddd66666dddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00700700aaaa9aaaddd5dd6dddddddddddd66ddddd66dddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00000000aaaa9aaadddd66ddddddddddddd6ddddddd5dddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00000000aaaa9aaadddddddddddddddddd66d55d55d66ddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00000000000000000000000000000000dd6dd56d56dd5ddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
b000b000000000000000000000000000dd56ddddddd55ddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
3b003b00000000000000000000000000ddd6dd56ddd5dddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
3bbbbb00000000000000000000000000ddd5dddddd5ddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
30bb0b00000000000000000000000000dddd656565dddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
3bbbbb00000000000000000000000000dddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
03333000000000000000000000000000dddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
03003000000000000000000000000000dddddddddddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
__map__ | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0101030303030303030303030303010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0103030303020303030303030203030100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0103030303030303030303020303030100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0103030303030303040503030303030100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0103030203030303141503030303030100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment