demos uploaded

This commit is contained in:
2022-05-05 16:32:31 +02:00
parent 012a2606ed
commit 7e9b57dafe
8 changed files with 290 additions and 1 deletions

3
demos/bola.lua Normal file
View File

@@ -0,0 +1,3 @@
p=0.45 a=0 c=cos s=sin function update()cls()for m=0,63 do
N=2*p*(m%8)M=p*flr(m/8)x,y,z=s(M)*c(N),s(M)*s(N),c(M)I,J=c(a),s(a)y,z=y*I-z*J,y*J+z*I
x,z=x*I-z*J,x*J+z*I x,y=x/(z+4),y/(z+4)print(chr(47-sgn(z)),20+x*70,15+y*55)end a=a+0.03 end

6
demos/checker3d.lua Normal file
View File

@@ -0,0 +1,6 @@
for i=0,1199 do poke(i,207) end o=0
function update()o=o-0.05
for y=1,14 do for x=0,39 do
c=(flr((x-20)/(2*y)+o)+flr(10/y))%2
poke(flr(1200+x+(15+y)*40),c*15)end
end end

9
demos/cube.lua Normal file
View File

@@ -0,0 +1,9 @@
a=0 function l(b,c,i,j)d,e=i-b,j-c
s=max(abs(d),abs(e))i,j=d/s,e/s for
v=0,s-1 do b,c=b+i,c+j print("#",b,c)end end
function r(u)f,g,h=(u>>2&1)*2-1,(u>>1&1)*2-1,(u&1)*2-1
f,h=f*cos(a)-h*sin(a),f*sin(a)+h*cos(a)return f/(h+4),g/(h+4)end
function update()cls()for n=0,7 do
x,y=r(n)for k=0,2 do m=n~(1<<k)if m>n then
f,g=r(m)l(20+x*40,15+y*30,20+f*40,15+g*30)
end end end a=a+0.05 end

7
demos/fire.lua Normal file
View File

@@ -0,0 +1,7 @@
f={}p={0,1,5,4,6,12,14,15}for i=0,1199
do f[i]=0 poke(i,143)end
function update()for i=0,1119 do
if i<41 then f[1160+i]=rnd(2)*256 end
f[i]=(f[i+39]+f[i+40]+f[i+41]+f[i+80])/4.1
poke(1200+i,p[mid(0,flr(f[i]/4),7)+1])
end end

4
demos/rotozoom.lua Normal file
View File

@@ -0,0 +1,4 @@
z,a=0,0 function update()for y=0,29 do for x=0,39 do
i,j=x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)i,j=i*z,j*z
print(chr(127+(flr(j)+flr(j))%2),x,y)end end
a=sin(time()/1000)z=abs(a)/3 end

8
demos/starfield.lua Normal file
View File

@@ -0,0 +1,8 @@
mode(0)f={}u={143,143,129,144,144}
function p(i)f[i]={x=40-rnd(80),y=15-rnd(30),z=rnd(5)}end
for i=0,50 do p(i) end
function update()cls()for i=0,50 do
f[i].z=f[i].z-0.05 y=f[i].z
m=40+f[i].x/y n=15+f[i].y/y
if m<0 or n<0 or m>79 or n>29 or y<=0 then p(i)end
print(chr(u[flr(f[i].z)+1]),m,n)end end

27
demos/ticker.lua Normal file
View File

@@ -0,0 +1,27 @@
C=66
a=0
ticker=0
function printchar(C, x,y)
if x<-8 or x>39 then return end
for j=0,7 do
line=peek(2560+C*8+j)
for i=0,7 do
X=x+7-i
ink(1+(flr(X)+j+flr(a))%15)
if X>0 and X<40 then
s=10+sin(a+(X)*0.1)*5
if line & 1 == 1 then print(chr(233),X,y+j+s) end
end
line = line >> 1
end
end
end
function update()
cls()
message="HOLA JAILERS"
for n=0,#message-1 do
printchar(ascii(message,n),n*8-flr(a*4)%(#message*8),0)
end
a=a+0.1
end

View File

@@ -1 +1,226 @@
print("Maziacs!") SIZE = 64
mapa = {}
hero = {
x=4,
y=3
}
sprites = {
{color=0x70, data={32,97,101,32,98,102,99,100,103}}
}
function init()
mode(3)
setchar(97,0,60,126,123,126,60,24,126)
setchar(98,126,90,58,25,63,60,36,34)
setchar(99,0,0,0,0,0,1,0,0)
setchar(100,33,32,32,64,128,0,192,0)
setchar(101,0,0,0,0,0,0,2,4)
setchar(102,8,16,32,64,128,0,0,0)
setchar(103,0,128,64,64,64,64,112,0)
--mapa = newsurf((SIZE+1)*2, (SIZE+1)*2)
for i=0,(SIZE*SIZE)-1 do
mapa[i] = 1
end
local startx = 1+flr(rnd((SIZE/2)-2))*2
local starty = 1+flr(rnd((SIZE/2)-2))*2
--pset(startx-1, starty-1, 7)
--pset(startx-1, starty, 7)
--pset(startx-1, starty+1, 7)
--pset(startx+1, starty-1, 7)
--pset(startx+1, starty, 7)
--pset(startx+1, starty+1, 7)
--pset(startx, starty-1, 7)
--pset(startx, starty+1, 7)
--local rando = flr(rnd(2))
currentx,currenty=startx,starty--1
--if rando == 0 then
-- pset(startx+2, currenty, 7)
-- pset(startx+3, currenty, 7)
-- currentx=startx+3
--elseif rando == 1 then
-- pset(startx-2, currenty, 7)
-- pset(startx-3, currenty, 7)
-- currentx=startx-3
--end
create()
tomap()
--settrans(255)
--poke(32,65)
end
mazedone = false
longest_path = 1
current_path = 1
lx = 0
ly = 0
function pget(x,y)
return mapa[(x%SIZE)+(y%SIZE)*65]
end
function pset(x,y,val)
mapa[(x%SIZE)+(y%SIZE)*65] = val
end
function create()
local LIMIT = SIZE-2
while mazedone == false do
local val = pget(currentx, currenty)
local paths = {}
local numpaths = 0
if (currentx > 2) and (pget(currentx-2, currenty)==1) then
paths[numpaths] = 0
numpaths = numpaths + 1
end
if (currentx < LIMIT) and (pget(currentx+2, currenty)==1) then
paths[numpaths] = 1
numpaths = numpaths + 1
end
if (currenty > 2) and (pget(currentx, currenty-2)==1) then
paths[numpaths] = 2
numpaths = numpaths + 1
end
if (currenty < LIMIT) and (pget(currentx, currenty+2)==1) then
paths[numpaths] = 3
numpaths = numpaths + 1
end
if numpaths > 0 then
current_path = current_path + 1
local option = paths[flr(rnd(numpaths))]
if option == 0 then
pset(currentx-1, currenty, 7)
currentx = (currentx - 2)%SIZE
pset(currentx, currenty, 7)
elseif option == 1 then
pset(currentx+1, currenty, 7)
currentx = (currentx + 2)%SIZE
pset(currentx, currenty, 7)
elseif option == 2 then
pset(currentx, currenty-1, 7)
currenty = (currenty - 2)%SIZE
pset(currentx, currenty, 7)
elseif option == 3 then
pset(currentx, currenty+1, 7)
currenty = (currenty + 2)%SIZE
pset(currentx, currenty, 7)
end
else
if longest_path < current_path then
longest_path = current_path
lx = currentx
ly = currenty
end
current_path = current_path - 1
pset(currentx, currenty, 8)
if (currentx > 2) and (pget(currentx-1, currenty)==7) and (pget(currentx-2, currenty)==7) then
pset(currentx-1, currenty, 8)
currentx = (currentx-2)%SIZE
elseif (currentx < LIMIT) and (pget(currentx+1, currenty)==7) and (pget(currentx+2, currenty)==7) then
pset(currentx+1, currenty, 8)
currentx = (currentx+2)%SIZE
elseif (currenty > 2) and (pget(currentx, currenty-1)==7) and (pget(currentx, currenty-2)==7) then
pset(currentx, currenty-1, 8)
currenty = (currenty-2)%SIZE
elseif (currenty < LIMIT) and (pget(currentx, currenty+1)==7) and (pget(currentx, currenty+2)==7) then
pset(currentx, currenty+1, 8)
currenty = (currenty+2)%SIZE
else
while pget(lx, ly-1) ~= 1 do ly = ly - 1 end
pset(lx, ly, 9)
mazedone = true
end
end
end
end
function mset(x, y, val)
local addr = x+y*32
poke(addr, 32) addr=addr+1
poke(addr, 32) addr=addr+1
poke(addr, 32) addr=addr+30
poke(addr, 32) addr=addr+1
poke(addr, 32) addr=addr+1
poke(addr, 32) addr=addr+30
poke(addr, 32) addr=addr+1
poke(addr, 32) addr=addr+1
poke(addr, 32) addr=0x300+x+y*32
poke(addr, val) addr=addr+1
poke(addr, val) addr=addr+1
poke(addr, val) addr=addr+30
poke(addr, val) addr=addr+1
poke(addr, val) addr=addr+1
poke(addr, val) addr=addr+30
poke(addr, val) addr=addr+1
poke(addr, val) addr=addr+1
poke(addr, val)
end
function mset2(x, y, val)
poke(x+y*32, 32)
poke(0x300+x+y*32, val)
end
function draw_sprite(x,y,num)
local addr = (x*3)+(y*3)*32
poke(addr, sprites[num].data[1]) addr=addr+1
poke(addr, sprites[num].data[2]) addr=addr+1
poke(addr, sprites[num].data[3]) addr=addr+30
poke(addr, sprites[num].data[4]) addr=addr+1
poke(addr, sprites[num].data[5]) addr=addr+1
poke(addr, sprites[num].data[6]) addr=addr+30
poke(addr, sprites[num].data[7]) addr=addr+1
poke(addr, sprites[num].data[8]) addr=addr+1
poke(addr, sprites[num].data[9]) addr=0x300+(x*3)+(y*3)*32
poke(addr, sprites[num].color) addr=addr+1
poke(addr, sprites[num].color) addr=addr+1
poke(addr, sprites[num].color) addr=addr+30
poke(addr, sprites[num].color) addr=addr+1
poke(addr, sprites[num].color) addr=addr+1
poke(addr, sprites[num].color) addr=addr+30
poke(addr, sprites[num].color) addr=addr+1
poke(addr, sprites[num].color) addr=addr+1
poke(addr, sprites[num].color)
end
camx = 0
camy = 0
function tomap()
for y=0,7 do
for x=0,9 do
local val = 0x77
if pget(x+camx,y+camy) == 1 then val = 0x11 end
mset(x*3, y*3, val)
end
end
end
snd=100
function update()
if cnt() >= 6 then
rst()
if btn(KEY_LEFT) and pget(hero.x-1,hero.y) ~= 1 then
hero.x = hero.x-1
sound(snd,5) if snd==100 then snd=120 else snd=100 end
end
if btn(KEY_RIGHT) and pget(hero.x+1,hero.y) ~= 1 then
hero.x = hero.x+1
sound(snd,5) if snd==100 then snd=120 else snd=100 end
end
if btn(KEY_UP) and pget(hero.x,hero.y-1) ~= 1 then
hero.y = hero.y-1
sound(snd,5) if snd==100 then snd=120 else snd=100 end
end
if btn(KEY_DOWN) and pget(hero.x,hero.y+1) ~= 1 then
hero.y = hero.y+1
sound(snd,5) if snd==100 then snd=120 else snd=100 end
end
camx = hero.x-4
camy = hero.y-3
tomap()
draw_sprite(4,3,1)
end
end