-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo-calcul-camera.p8
65 lines (63 loc) · 2.13 KB
/
demo-calcul-camera.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
pico-8 cartridge // http://www.pico-8.com
version 29
__lua__
function _init()
x,y=0,0
blink=false
blinkt=0
end
function _update()
if (btnp(⬅️)) x=mid(0,x-1,48)
if (btnp(➡️)) x=mid(0,x+1,48)
if (btnp(⬆️)) y=mid(0,y-1,32)
if (btnp(⬇️)) y=mid(0,y+1,32)
camx=flr(x/16)*16
camy=flr(y/16)*16
blinkt+=1
if blinkt==6 then
blinkt=0
blink=not blink
end
end
function _draw()
cls(1)
uix,uiy=16,5
print("p.x:"..x,uix,uiy,10)
print("p.y:"..y,uix,uiy+6,10)
print("/ 16 = "..x/16,uix+28,uiy,13)
print("/ 16 = "..y/16,uix+28,uiy+6,13)
print("arrondi",uix,uiy+16,13)
spr(1,uix+30,uiy+14)
print("x:"..flr(x/16).." * 16 = "..camx,uix+40,uiy+16,13)
print("y:"..flr(y/16).." * 16 = "..camy,uix+40,uiy+22,13)
print("position camera:",uix,uiy+32,13)
print("camx:"..camx,uix,uiy+39,7)
print("camy:"..camy,uix,uiy+45,7)
uiy=60
rectfill(uix,uiy,uix+96,uiy+64,3)
fillp(0b0101101001011010.1)
for i=1,3 do
for j=1,2 do
local x=uix+(i-1)*32
local y=uiy+(j-1)*32
rect(x,y,x+32,y+32,6)
end
end
fillp(0)
rect(uix+camx*2,uiy+camy*2,
uix+camx*2+32,uiy+camy*2+32,7)
rect(uix+camx*2,uiy+camy*2,
uix+camx*2+1,uiy+camy*2+1,
blink and 7 or 6)
rect(uix+x*2,uiy+y*2,
uix+x*2+1,uiy+y*2+1,
blink and 10 or 9)
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
007007000000d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0007700000000d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000ddddddd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0070070000000d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000