forums.evilmana.com
Welcome, Guest. Please login or register.

Login with username, password and session length
September 08, 2010, 09:14:03 AM
.
News: 08/07/2009 - Welcome to the revived and revamped evilmana forums. Take a look around  for new features such as:New Theme, New Reputation System, and Arcade!
Coming Soon: An all new evilmana.com main site!
Pages: 1 ... 4 5 [6]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read June 10, 2008, 08:43:52 AM #75
hardhat

Re: Lua Code Challenge 5: The little Mini-Game that could

Okay, well I'm still not done, but here is a 3D version of the game I posted earlier.

Code:
Music.playFile("s.it",1)
wh=Color.new(255,255,255)
bl=Color.new(0,64,255)
p={{0,0,0,255},{255,0,220,0},{127,198,254,255},{255,246,254,255},}
s="RDP[D__R@aPAt@YAt@__P@b@sAqAV@wA_^@bPCu@VCu@_P[@cQ@xAW@vA_[@bP@tBs@V@x@_Z@bPEv@U@y@_[@a@w@t@S@{@_]P@uAt@R@|@_]QE`BpBR@|@_]R@a@cAa@R@|@_]R@`q`qa@a@S@{@_]PB`p@`p@d@SAz@_]@b@g@`@R@a@y@_]@c@fAS@bJ_]P@g@b@S@`@j@_]QCcAa@T@j@_^R@bBb@V@h@__SAdAXAdA__PUD`[D`__QT@e@Y@e@__PS@g@W@g@__RA`@c@a@V@`@c@`@__PAb@c@a@V@`@c@`@__@cAc@b@UBc@`@__@c@dAa@V@d@`@__@aIb@UF`@__CP@uAb@T@s@a@__T@uB`@U@tA__PT@u@PAV@u@__PT@u@X@v@__PT@r@q@X@rAq@__PT@r@q@WArP@r@__RArAr@U@s@PAr@_^Q@rBpAp@T@pAp@P@pAqA_]P@sAt@S@tAp@t@_]Q@r@P@s@T@s@P@p@rA_]RCQCVDQE_^__Wr_T__UuQr^__RqP|P[__Rp~P[__Qp~q[__Rp~p[__R{`s[__x`t`s[__xbq`t[__Py`q`t[__Rz`t[__T}P[__T{^S@T@T@_Sza]R@p@R@p@R@p@_SvQa^R@p@R@p@R@p@_Ti^R@p@R@p@Q@r@_Vf^Q@r@P@r@P@r@Ub^d_Q@rBrBr@Td]d_Q@~@Td]d_Q@~@Ub^d_Q@rBrBr@SqPp_e^Q@r@P@r@P@r@SsPqP[e^Q@r@P@r@P@r@Vs[f^Q@r@P@r@P@r@Uq^f^QDPDPDUq^f^";
im=Image.createEmpty(128,128)
gr=Image.createEmpty(16,16)
for x=0,15 do
for y=0,15 do
gr:pixel(x,y,Color.new(64+x,192-y,64+x))
end
end
x=0
y=0
for k=1,2 do
for i=1,s:len() do
n=s:byte(i)
c=math.mod(n,16)
n=(n-64-c)/16+1
c=c+1
r=p[n]
q=Color.new(r[1],r[2],r[3],r[4]);
for j=1,c do
im:pixel(x,y,q)
im:pixel(127-x,y,q)
x=x+1
end
if x==64 then y=y+1;x=0 end
end
p[4]={64,255,48,255}
p[3]={192,48,0,255}
end
for y=0,37 do
for x=0,17 do
im:pixel(36+y,20+x,im:pixel(x,y))
end
end


-- game
hg=0
function setup()
t=0
m=0
n=0
l=0
j=0
d=0
e=0
f=3
g=0
z=0
end
function dC(tt,x,y,j)
local vt={}
local o=1
for a=1,6 do
tu=(tt[1]+q[a]*tt[3])/128
tv=(tt[2]+(1-r[a])*tt[4])/128
vt[o]={tu,tv,x+q[a]*tt[3],y,-30+r[a]*tt[4]+j}
o=o+1
end
Gum.drawArray(Gu.TRIANGLES,Gu.TEXTURE_32BITF+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,vt)
end
function dS(tt,c,d,w,h)
local vt={}
local o=1
for x=-c,c,w do
for y=-d,d,h do
dC(tt,x,y,0)
end
end
end
setup()
frame=0
angle=0
while true do
Gu.start3d()
Gu.clearDepth(0)
Gu.clearColor(bl)
Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT)
Gum.matrixMode(Gu.PROJECTION)
Gum.loadIdentity()
Gum.perspective(35, 16/9, 2, 200)
Gum.matrixMode(Gu.VIEW)
Gum.loadIdentity()
-- Gum.lookAt(-30,2,20,2,2,0,0,1,0)
-- Gum.translate(-30,2,20)
Gum.rotateXYZ(-75*Gu.PI/180,0,angle*Gu.PI/180) -- 30*Gu.PI/180)
Gum.matrixMode(Gu.MODEL)
Gum.loadIdentity()
Gu.enable(Gu.BLEND)
Gu.blendFunc(Gu.ADD, Gu.SRC_ALPHA, Gu.ONE_MINUS_SRC_ALPHA,0,0)
Gu.enable(Gu.TEXTURE_2D);
Gu.disable(Gu.CULL_FACE)
Gu.texFunc(Gu.TFX_MODULATE,Gu.TCC_RGBA)
Gu.texEnvColor(wh)
Gu.texFilter(Gu.LINEAR, Gu.LINEAR)
Gu.texScale(1, 1)
Gu.texOffset(0, 0)
Gu.ambientColor(wh)
Gum.matrixMode(Gu.MODEL)
Gum.loadIdentity()
Gum.translate(-m,128-l,-j/2)
r={0,1,0,0,1,1}
q={0,0,1,1,0,1}
-- Ground
land={}
o=1
for x=-3,3 do
for y=-3,3 do
for a=1,6 do
land[o]={q[a],r[a],(x+q[a])*40,(y+r[a])*40,-30}
o=o+1
end
end
end
Gu.texImage(gr)
Gum.drawArray(Gu.TRIANGLES,Gu.TEXTURE_32BITF+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,land)

Gu.texImage(im)
-- Trees
dS({32,64+38,24,26},40,128,80,32)
-- Fence
dS({2,51,17,13},17,128,17,64)
-- Hero
if d==0 then o=0 else o=18 end
if t>5 then p=0 else p=18 end
if e>0 then o=e-o;p=e-p end
if z>0 then dC({36,20,38,18},m,l-48,j/2)
else dC({o,0,18,20},m,l-48,j/2+18);dC({p,20,18,18},m,l-48,j/2) end
Gu.end3d()
t=t+1;if t>10 then t=0 end

screen:print(30,0,string.format("Lives %d  Score %d  Highscore %d",f,g,hg),wh)
if z>0 then screen:print(200,10,"Press O to continue",wh) end
if z>0 and f==0 then screen:print(200,20,"*** Game Over ***",wh) end
screen:print(30,30,string.format("frame %d angle %d",frame,angle),wh)
frame=frame+1
screen.waitVblankStart()
screen.flip()
u=z
while z>0 do
pad=Controls.read()
if not pad:circle() then z=0 end
oldpad=pad
end
z=u
while z>0 do
screen.waitVblankStart()
pad=Controls.read()
if oldpad:circle() and not pad:circle() then z=0 end
oldpad=pad
n=n-math.mod(n,64)
end

pad=Controls.read()
if pad:l() then angle=angle-2 end
if pad:r() then angle=angle+2 end
if pad:left() and m>-20 then m=m-1;e=0 end
if pad:right() and m<20 then m=m+1;e=127-18 end
if pad:down() and n>2 then n=n-2;d=0 end
if pad:up() then n=n+2;d=1 end
if j>0 then
j=j+a
a=a-0.5
if j<0 then j=0 end
end
l=math.mod(n,64)
if pad:up() and l==40 then g=g+200 end
if pad:cross() and not oldpad:cross() and j==0 then a=7;j=a end
oldpad=pad
if g>hg then hg=g end
if f==0 then setup() end
if j==0 and l>32 and l<48 then f=f-1;z=1 end
if pad:start() then break end
end

The size has ballooned to 4745 bytes, but I haven't really tried to squeeze the source either.  I have lots of ideas on how to make the gameplay better.  But I'm not sure how many of them will still fit in 5k.  I'll have to work on it more.  Man does Lua ever make you work hard to keep the framerate up.

You can consider the attached EBOOT to be version 2.

But how do I take screenshots in LuaPlayer 0.20?
Offline  
Read June 10, 2008, 10:30:05 AM #76
emcp

Re: Lua Code Challenge 5: The little Mini-Game that could

Code:
screen:save("./screenshot.png")

good work havnt actually played it though but if youve managed tot urn that game into 3d within 5 kb you deserve it

but think i still prefer the gameplay of the other game the triangle shooter
but A for effort and pushin lua and size limit


Offline  
Read July 12, 2008, 08:11:29 AM #77
Nielkie

Re: Lua Code Challenge 5: The little Mini-Game that could


I was bored, so I decided to cut apart and reduce the game I am currently lightly working on.
Pretty much a clone of JetSlalom (ww2.freearcade.com/Jetslalom.jav/Jetslalom.html). Fully 3d, final size is 4922 bytes.
Controls are simple, press L or R, or Left and Right, to move the ship. Ship is a model of the starfox SNES ship from Google's 3D Warehouse (http://sketchup.google.com/3dwarehouse/details?mid=ff572293ac98f874b1bb33592cef0aea&prevstart=12)

Code:
C=Color
s=screen
aw={v={{116.459345,-24.25,0},{112.75,-21.75,0},{114.984882,-24.25,-15.907985},{119.410685,-24.25,31.842015},{109.040655,-24.25,0},{112.75,-28.733404,0},{114.984882,24.25,-15.907985},{112.75,21.75,0},{116.459345,24.25,0},{109.040655,24.25,0},{119.410685,24.25,31.842015},{112.75,28.733404,0},{116.459345,24.25,0},{140.348146,16.713172,0},{171.305039,91.901707,-15.563226},{128.535034,20.897719,2.271555},{168.672720,-93.236184,-18.484792},{140.655326,-17.987619,1.678},{116.459345,-24.25,0},{128.557335,-21.717480,3.073269},{112.75,21.75,0},{112.75,-21.75,0},{110.624104,0,6.239738},{0,0,0},{112.75,0,20.25},{129,0,14.07402}},c={C.new(0,0,204),C.new(198,198,198),C.new(255,63,0)},m={{1,0},{1,1},{1,2},{1,3},{1,1},{1,0},{1,3},{1,4},{1,1},{1,3},{1,5},{1,4},{1,3},{1,0},{1,5},{1,0},{1,2},{1,5},{1,5},{1,2},{1,4},{1,2},{1,1},{1,4},{1,6},{1,7},{1,8},{1,9},{1,7},{1,6},{1,7},{1,9},{1,10},{1,9},{1,11},{1,10},{1,9},{1,6},{1,11},{1,11},{1,6},{1,8},{1,11},{1,8},{1,10},{1,8},{1,7},{1,10},{2,12},{2,13},{2,14},{2,13},{2,12},{2,15},{2,15},{2,12},{2,14},{2,13},{2,15},{2,14},{2,16},{2,17},{2,18},{2,16},{2,19},{2,17},{2,16},{2,18},{2,19},{2,19},{2,18},{2,17},{3,20},{3,21},{3,22},{3,25},{3,22},{3,21},{3,25},{3,20},{3,22},{2,20},{2,23},{2,21},{2,24},{2,23},{2,20},{2,21},{2,23},{2,24},{2,25},{2,21},{2,24},{2,25},{2,24},{2,20}}}w=C.new(255,255,255)b=C.new(0,0,0)dg=C.new(65,198,75)m=C.new(0,140,69)Py={}PC={C.new(252,15,192),C.new(0,0,255),C.new(255,255,0),C.new(255,0,0)}function Pc()for i=1,table.getn(Py)do
if(Py[i].d>=-3 and Py[i].d<-1.6)then
if math.abs(Br)<=0.1 then
return math.abs(Py[i].x)<=0.8 or((math.abs(Py[i].x)>=0.8 and math.abs(Py[i].x)<=1.2)and Py[i].d>=-1.8)elseif(Br>=-0.3 and Br<=-0.1)then
return(Py[i].x<=0.8 and Py[i].x>=-0.4)or((Py[i].x>=-0.7 and Py[i].x<=1.5)and Py[i].d>=-1.8)elseif(Br>=0.1 and Br<=0.3)then
return(Py[i].x>=-0.8 and Py[i].x<=0.4)or((Py[i].x<=0.7 and Py[i].x>=-1.5)and Py[i].d>=-1.8)elseif(Br>=0.3 and Br<=0.523)then
return(Py[i].x>=-1 and Py[i].x<=0.2)or((Py[i].x<=0.4 and Py[i].x>=-1.5)and Py[i].d>=-1.8)elseif(Br<=-0.3 and Br>=-0.523)then
return(Py[i].x<=1 and Py[i].x>=-0.2)or((Py[i].x>=-0.4 and Py[i].x<=1.5)and Py[i].d>=-1.8)end
end
end
return 1==2
end
Br=0
C1=C.new(0,193,234)C2=C.new(0,255,0)function pR(A,T,B)B=B or C.new(0,0,0)s:print(480-string.len(T)*8,A,T,B)end
G={d=0,o=5,l=1,t=b}math.randomseed(os.time())while 1 do
q=Controls.read()G.d=G.d+1
if q:left()or q:l()then
Br=Br-0.025
end
if q:right()or q:r()then
Br=Br+0.025
end
if Br>0.523 then
Br=0.523
elseif Br<-0.523 then
Br=-0.523
end
if Br~=0 and not q:left()and not q:right()and not q:l()and not q:r()then
if Br>0.0087 then
Br=Br-0.0087
elseif Br<-0.0087 then
Br=Br+0.0087
else
Br=0
end
end
if math.random(G.o)==1 then
table.insert(Py,{x=math.random(-30,30),d=-27,c=PC[math.random(4)]})end
for i=1,table.getn(Py)do
if Py[i]~=nil then
Py[i].d=Py[i].d+0.4
Py[i].x=Py[i].x-0.2*(Br/0.523)if Py[i].d>0 then
table.remove(Py,i)end
end
end
Gu.start3d()Gu.clearDepth(0);Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT)Gum.matrixMode(Gu.PROJECTION)Gum.loadIdentity()Gum.perspective(50,480/272,0.5,1000)Gum.matrixMode(Gu.VIEW)Gum.loadIdentity()Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()Gu.enable(Gu.BLEND)Gu.blendFunc(Gu.ADD,Gu.SRC_ALPHA,Gu.ONE_MINUS_SRC_ALPHA,0,0)local k={x=240+300*math.cos(Br-math.pi),y=136+300*math.sin(Br-math.pi)}local l={x=240+300*math.cos(Br),y=136+300*math.sin(Br)}Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()Gum.translate(0,0,-294)Gu.disable(Gu.TEXTURE_2D)Gum.drawArray(Gu.TRIANGLES,Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,{{C1,-243,139,0},{C1,243,139,0},{C1,k.x-240,k.y-136,0},{C1,k.x-240,k.y-136,0},{C1,243,139,0},{C1,l.x - 240,l.y - 136,0},{C2,-243,-139,0},{C2,k.x-240,k.y-136,0},{C2,l.x-240,l.y-136,0},{C2,-243,-139,0},{C2,l.x-240,l.y-136,0},{C2,243,-139,0}})Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()local v={}for i,t in ipairs(Py)do
table.insert(v,{t.c,t.x+-0.5,-1,t.d})table.insert(v,{t.c,t.x+0,1,t.d})table.insert(v,{t.c,t.x+0.5,-1,t.d})end
Gum.translate(0,0.2,0)Gu.disable(Gu.TEXTURE_2D)Gum.rotateXYZ(0,0,Br)Gum.drawArray(Gu.TRIANGLES,Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,v)Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()local Fmodel={}for i,ver in ipairs(aw.m)do
table.insert(Fmodel,{aw.c[ver[1]],aw.v[ver[2]+1][1]*0.008,aw.v[ver[2]+1][2]*0.008,aw.v[ver[2]+1][3]*0.008})end
Gum.translate(0,-0.5,-3)Gu.disable(Gu.TEXTURE_2D)Gum.rotateXYZ(math.rad(90+5*(math.abs(Br)/0.523)),math.rad(180+10*(-Br/0.523)),math.rad(90+5*(-Br/0.523)))Gum.drawArray(Gu.TRIANGLES,Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,Fmodel)Gu.end3d()pR(10,math.floor(G.d/2),G.t)s:print(10,10,"Level: "..G.l,G.t)if Pc()then
s:print(200,136,"GAME OVER",G.t)pR(10,math.floor(G.d/2),G.t)s.waitVblankStart()s.flip()s.waitVblankStart(120)break
end
if G.d>2000 and G.l==1 then
G.o=4
C1=C.new(255,168,168)C2=dg
G.l=2
elseif G.d>4000 and G.l==2 then
G.o=3
C1=b
C2=m
G.t=w
G.l=3
end
s.waitVblankStart()s.flip()end
« Last Edit: September 24, 2008, 08:55:00 AM by Nielkie »
Offline  
Read July 12, 2008, 09:20:22 AM #78
yaustar

Re: Lua Code Challenge 5: The little Mini-Game that could

Impressive work!
Offline  
Read July 12, 2008, 11:30:57 AM #79
emcp

Re: Lua Code Challenge 5: The little Mini-Game that could


I was bored, so I decided to cut apart and reduce the game I am currently lightly working on.
Pretty much a clone of JetSlalom (ww2.freearcade.com/Jetslalom.jav/Jetslalom.html). Fully 3d, final size is 4919 bytes.
Controls are simple, press L or R, or Left and Right, to move the ship. Ship is a model of the starfox SNES ship from Google's 3D Warehouse (http://sketchup.google.com/3dwarehouse/details?mid=ff572293ac98f874b1bb33592cef0aea&prevstart=12)

Code:
C=Color
s=screen
aw={v={{116.459345,-24.25,0},{112.75,-21.75,0},{114.984882,-24.25,-15.907985},{119.410685,-24.25,31.842015},{109.040655,-24.25,0},{112.75,-28.733404,0},{114.984882,24.25,-15.907985},{112.75,21.75,0},{116.459345,24.25,0},{109.040655,24.25,0},{119.410685,24.25,31.842015},{112.75,28.733404,0},{116.459345,24.25,0},{140.348146,16.713172,0},{171.305039,91.901707,-15.563226},{128.535034,20.897719,2.271555},{168.672720,-93.236184,-18.484792},{140.655326,-17.987619,1.678},{116.459345,-24.25,0},{128.557335,-21.717480,3.073269},{112.75,21.75,0},{112.75,-21.75,0},{110.624104,0,6.239738},{0,0,0},{112.75,0,20.25},{129,0,14.07402}},c={C.new(0,0,204),C.new(198,198,198),C.new(255,63,0)},m={{1,0},{1,1},{1,2},{1,3},{1,1},{1,0},{1,3},{1,4},{1,1},{1,3},{1,5},{1,4},{1,3},{1,0},{1,5},{1,0},{1,2},{1,5},{1,5},{1,2},{1,4},{1,2},{1,1},{1,4},{1,6},{1,7},{1,8},{1,9},{1,7},{1,6},{1,7},{1,9},{1,10},{1,9},{1,11},{1,10},{1,9},{1,6},{1,11},{1,11},{1,6},{1,8},{1,11},{1,8},{1,10},{1,8},{1,7},{1,10},{2,12},{2,13},{2,14},{2,13},{2,12},{2,15},{2,15},{2,12},{2,14},{2,13},{2,15},{2,14},{2,16},{2,17},{2,18},{2,16},{2,19},{2,17},{2,16},{2,18},{2,19},{2,19},{2,18},{2,17},{3,20},{3,21},{3,22},{3,25},{3,22},{3,21},{3,25},{3,20},{3,22},{2,20},{2,23},{2,21},{2,24},{2,23},{2,20},{2,21},{2,23},{2,24},{2,25},{2,21},{2,24},{2,25},{2,24},{2,20}}}w=C.new(255,255,255)b=C.new(0,0,0)dg=C.new(65,198,75)m=C.new(0,140,69)Py={}PC={C.new(252,15,192),C.new(0,0,255),C.new(255,255,0),C.new(255,0,0)}function Pc()for i=1,table.getn(Py)do
if(Py[i].d>=-3 and Py[i].d<-1.6)then
if math.abs(Br)<=0.1 then
return math.abs(Py[i].x)<=0.8 or((math.abs(Py[i].x)>=0.8 and math.abs(Py[i].x)<=1.2)and Py[i].d>=-1.8)elseif(Br>=-0.3 and Br<=-0.1)then
return(Py[i].x<=0.8 and Py[i].x>=-0.4)or((Py[i].x>=-0.7 and Py[i].x<=1.5)and Py[i].d>=-1.8)elseif(Br>=0.1 and Br<=0.3)then
return(Py[i].x>=-0.8 and Py[i].x<=0.4)or((Py[i].x<=0.7 and Py[i].x>=-1.5)and Py[i].d>=-1.8)elseif(Br>=0.3 and Br<=0.523)then
return(Py[i].x>=-1 and Py[i].x<=0.2)or((Py[i].x<=0.4 and Py[i].x>=-1.5)and Py[i].d>=-1.8)elseif(Br<=-0.3 and Br>=-0.523)then
return(Py[i].x<=1 and Py[i].x>=-0.2)or((Py[i].x>=-0.4 and Py[i].x<=1.5)and Py[i].d>=-1.8)end
end
end
return false
end
Br=0
C1=C.new(0,193,234)C2=C.new(0,255,0)function pR(A,T,B)B=B or C.new(0,0,0)s:print(480-string.len(T)*8,A,T,B)end
G={d=0,o=5,l=1,t=b}math.randomseed(os.time())while true do
q=Controls.read()G.d=G.d+1
if q:left()or q:l()then
Br=Br-0.025
end
if q:right()or q:r()then
Br=Br+0.025
end
if Br>0.523 then
Br=0.523
elseif Br<-0.523 then
Br=-0.523
end
if Br~=0 and not q:left()and not q:right()and not q:l()and not q:r()then
if Br>0.0087 then
Br=Br-0.0087
elseif Br<-0.0087 then
Br=Br+0.0087
else
Br=0
end
end
if math.random(G.o)==1then
table.insert(Py,{x=math.random(-30,30),d=-27,c=PC[math.random(4)]})end
for i=1,table.getn(Py)do
if Py[i]~=nil then
Py[i].d=Py[i].d+0.4
Py[i].x=Py[i].x-0.2*(Br/0.523)if Py[i].d>0then
table.remove(Py,i)end
end
end
Gu.start3d()Gu.clearDepth(0);Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT)Gum.matrixMode(Gu.PROJECTION)Gum.loadIdentity()Gum.perspective(50,480/272,0.5,1000)Gum.matrixMode(Gu.VIEW)Gum.loadIdentity()Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()Gu.enable(Gu.BLEND)Gu.blendFunc(Gu.ADD,Gu.SRC_ALPHA,Gu.ONE_MINUS_SRC_ALPHA,0,0)local k={x=240+300*math.cos(Br-math.pi),y=136+300*math.sin(Br-math.pi)}local l={x=240+300*math.cos(Br),y=136+300*math.sin(Br)}Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()Gum.translate(0,0,-294)Gu.disable(Gu.TEXTURE_2D)Gum.drawArray(Gu.TRIANGLES,Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,{{C1,-243,139,0},{C1,243,139,0},{C1,k.x-240,k.y-136,0},{C1,k.x-240,k.y-136,0},{C1,243,139,0},{C1,l.x - 240,l.y - 136,0},{C2,-243,-139,0},{C2,k.x-240,k.y-136,0},{C2,l.x-240,l.y-136,0},{C2,-243,-139,0},{C2,l.x-240,l.y-136,0},{C2,243,-139,0}})Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()local v={}for i,t in ipairs(Py)do
table.insert(v,{t.c,t.x+-0.5,-1,t.d})table.insert(v,{t.c,t.x+0,1,t.d})table.insert(v,{t.c,t.x+0.5,-1,t.d})end
Gum.translate(0,0.2,0)Gu.disable(Gu.TEXTURE_2D)Gum.rotateXYZ(0,0,Br)Gum.drawArray(Gu.TRIANGLES,Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,v)Gum.matrixMode(Gu.MODEL)Gum.loadIdentity()local Fmodel={}for i,ver in ipairs(aw.m)do
table.insert(Fmodel,{aw.c[ver[1]],aw.v[ver[2]+1][1]*0.008,aw.v[ver[2]+1][2]*0.008,aw.v[ver[2]+1][3]*0.008})end
Gum.translate(0,-0.5,-3)Gu.disable(Gu.TEXTURE_2D)Gum.rotateXYZ(math.rad(90+5*(math.abs(Br)/0.523)),math.rad(180+10*(-Br/0.523)),math.rad(90+5*(-Br/0.523)))Gum.drawArray(Gu.TRIANGLES,Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D,Fmodel)Gu.end3d()pR(10,math.floor(G.d/2),G.t)s:print(10,10,"Level: "..G.l,G.t)if Pc()then
s:print(200,136,"GAME OVER",G.t)pR(10,math.floor(G.d/2))s.waitVblankStart()s.flip()s.waitVblankStart(120)break
end
if G.d>2000 and G.l==1 then
G.o=4
C1=C.new(255,168,168)C2=dg
G.l=2
elseif G.d>4000 and G.l==2then
G.o=3
C1=b
C2=m
G.t=w
G.l=3
end
s.waitVblankStart()s.flip()end


class
one bit of advice is tonne the colours down a bit maybe
the green is way to over powering


Offline  
Read July 12, 2008, 12:28:54 PM #80
Nielkie

Re: Lua Code Challenge 5: The little Mini-Game that could

class
one bit of advice is tonne the colours down a bit maybe
the green is way to over powering
It's not that bad in-game, the PSP's screen drasticly changes colours.
Offline  
Read August 19, 2008, 08:39:12 AM #81
hardhat

Re: Lua Code Challenge 5: The little Mini-Game that could

Looks like fun.  Good work.
Offline  
Read October 16, 2008, 03:10:19 AM #82
Nielkie

Re: Lua Code Challenge 5: The little Mini-Game that could

I got bored again.







This game uses the super-special-awesome compression method known as "cheating". Hurray for loop holes!

Script size is 3647 bytes.
Code:
fileurl="http://nielkie.luaplayer.org/files/EvilmanaComp/file.bin"
startfile="Menu/menu.lua"
expsize=4204481
white=Color.new(255,255,255)function Wlan.connect()Wlan.init()local c=Wlan.getConnectionConfigs()local numc=table.getn(c)local cs=1
while true do
oldpad=pad
pad=Controls.read()screen:clear()screen:print(10,10,"This game requires the internet,",white)screen:print(10,20,"please select a connection:",white)screen:print(0,(cs-1)*12+40,">",white)for i=1,numc do
screen:print(10,(i-1)*12+40,c[i],white)end
if pad:down()and not oldpad:down()then
cs=cs+1
if cs>numc then cs=1 end
elseif pad:up()and not oldpad:up()then
cs=cs-1
if cs<1 then cs=numc end
end
if pad:cross()and not oldpad:cross()then
screen:clear()screen:print(10,10,"Please Wait...",white)screen.waitVblankStart()screen.flip()Wlan.useConnectionConfig(cs)break
end
screen.waitVblankStart()screen.flip()end
while not Wlan.getIPAddress()do
System.sleep(100)end
connected=true
end
function Wlan.getUrlData(url)local toa=100
if not connected then return 1==2 end
if not string.find(url,".") then return 1==2 end
local eoh=string.find(url,"/")if eoh and eoh~=string.len(url)then
host=string.sub(url,1,eoh-1)subfile=string.sub(url,eoh)elseif not eoh then
host=url
subfile=""end
socket,error=Socket.connect(host,80)while not socket:isConnected()do System.sleep(100)end
request=socket:send("GET /"..subfile.." HTTP/1.0\r\n")request=socket:send("host: "..host.."\r\n\r\n")local dfile=io.open("file.bin","wb")local datasize=0
local tot=0
local ar=0
local ds=0
local hl=0
local hf=1==2
local sk=1==2
local size=0
while socket:isConnected()do
local db=socket:recv()dfile:write(db)tot=tot+1
if string.len(db)>0 then
ds=ds+string.len(db)tot=0
if not hf then
hl=string.find(db,"\r\n\r\n")if type(hl)=="number"then
headerfullloc=(ds-string.len(db))+hl
hf=true
if not sk then
local cll=string.find(db,"-Length: ")if type(cll)=="number"then
size=tonumber(string.sub(db,cll+9,string.find(db,"\n",cll+9)))end
if type(size)=="number"then
sizeknown=true
end
end
end
else
ar=ds-(headerfullloc+4)if sk then
if size<=ar and size~=0 then break end
end
end
end
if Controls.read():start()or tot>toa then break end
screen:clear()screen:print(10,10,"Loading... "..math.floor(100 * ((ar or 0) / expsize)) .."% complete",white)screen.waitVblankStart()screen.flip()end
dfile:close()socket:close()end
Wlan.connect()if connected==false then
os.exit()end
Wlan.getUrlData(fileurl)Wlan.term()collectgarbage()tfile=io.open("file.bin","rb")data=string.sub(tfile:read("*a"),headerfullloc+4)tfile:close()if string.len(data)~=expsize then
screen:clear()screen:print(10,10,"Loading failed,please try again.",white)screen.waitVblankStart()screen.flip()screen.waitVblankStart(180)os.exit()end
header=string.sub(data,1,10000)header=string.sub(header,1,string.find(header,string.char(0))+0)data=string.sub(data,10001)dirs={}files={}place=1
while true do
local e=string.find(header,"|",place)if e==nil then
break
end
local st=string.sub(header,place,e-1)place=place+string.len(st)+1
local fe=string.find(st,":")local type=string.sub(st,1,fe-1)if type=="dir"then
local path=string.sub(st,fe+1)table.insert(dirs,path)elseif type=="file"then
local se=string.find(st,":",fe+1)local path=string.sub(st,fe+1,se-1)local size=string.sub(st,se+1)table.insert(files,{path=path,size=size})end
end
place=nil
for i,dir in ipairs(dirs)do
System.createDirectory(dir)end
place=1
fnum=1
while fnum<=table.getn(files)do
local file=io.open(files[fnum].path,"wb")file:write(string.sub(data,place,place+files[fnum].size-1))file:close()place=place+files[fnum].size
fnum=fnum+1
end
data=nil
System.removeFile("file.bin")collectgarbage()dofile(startfile)
« Last Edit: March 29, 2009, 06:11:29 PM by Nielkie »
Offline  
Read October 16, 2008, 11:56:28 PM #83
tacticalpenguin

Re: Lua Code Challenge 5: The little Mini-Game that could

rofl

doesnt look familiar at all

the other cheating method i was thinking of was a wav file that happens to have a script in it hehe


tactical makes everything better
Offline  
Pages: 1 ... 4 5 [6]   Go Up
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re