0 Members and 1 Guest are viewing this topic.
playerImg=image.new("\020\000\000\000\020\000\000\000\000\000\000\000(\000\000\000\016\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128")cubesX={1,5,7,6,4,6,4,1,3,2,3,7,8,9,1,2,3,4,2,6,7,1,9,1,2,3,4}cubesY={1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9}lastCube=1player=0speed=0.1moving=falsedir=1moveStart=0menu=truescore=0level=1color={225,170,0}rotation=0function render(gc) drawHorizon(gc) local size,x,y,i,polygon for j=1,27 do i=(j+lastCube-2)%27+1 size=cubesY[i]*cubesY[i]/1.5+8 x=(cubesX[i]-7-player)*20*(cubesY[i]*cubesY[i]/20+0.5)-size/2 y=cubesY[i]*cubesY[i]*2-152 polygon=rotate({x,y,x+size,y,x+size,y+size,x,y+size,x,y}) if cubesY[i]>1 then gc:setColorRGB(color[1],color[2],color[3]) gc:fillPolygon(polygon) gc:setColorRGB(0,0,0) gc:drawPolyLine(polygon) end if cubesY[i]>7.5 and cubesY[i]<8.5 then if x<7 and x+size>-7 then on.escapeKey() end end endendfunction rotate(p) local s,c=math.sin(rotation),math.cos(rotation) return {p[1]*c-p[2]*s+159,p[1]*s+p[2]*c+202,p[3]*c-p[4]*s+159,p[3]*s+p[4]*c+202,p[5]*c-p[6]*s+159,p[5]*s+p[6]*c+202,p[7]*c-p[8]*s+159,p[7]*s+p[8]*c+202,p[9]*c-p[10]*s+159,p[9]*s+p[10]*c+202}endfunction updateCubes() local step=menu and 0.06 or speed for i=1,27 do cubesY[i]=cubesY[i]+step if cubesY[i]>10 then if score%1000<800 then cubesX[i]=math.random(10,140)/10+player else cubesX[i]=math.random(10,140)/200+player+(i-1)%2*5+4.1 end cubesY[i]=1 lastCube=lastCube==1 and 27 or lastCube-1 end endendfunction updateMove() if moving then player=player+0.07*dir if math.abs(rotation)<0.1 then rotation=rotation-0.005*dir end if timer.getMilliSecCounter()-moveStart>=150 then moving=false end else if math.abs(rotation)>0.005 then rotation=rotation-0.005*rotation/math.abs(rotation) end endendfunction drawPlayer(gc) if not menu then gc:drawImage(playerImg,149,192) endendfunction drawHorizon(gc) local s,c=math.sin(rotation),math.cos(rotation) gc:setColorRGB(0,0,0) gc:drawLine(s*142-c*200+159,202-c*142-s*200,c*200+s*142+159,s*200-c*142+202)endfunction drawMenu(gc) if menu then gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",30) gc:drawString("CubeField",80,10,"top") gc:setFont("sansserif","b",12) gc:drawString("Press Enter",115,150,"top") local highscore=var.recall("highscore") if not highscore then var.store("highscore",0) highscore=0 end if score>highscore then var.store("highscore",score) document.markChanged() end local str="Score : "..tostring(score).." Highscore : "..tostring(highscore) gc:drawString(str,159-gc:getStringWidth(str)/2,100,"top") endendfunction drawScore(gc) if not menu then gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",12) gc:drawString(tostring(score),2,0,"top") if score%1000>950 then gc:setFont("sansserif","r",30) gc:drawString("Speed Up !",80,10,"top") end endendfunction levelUp() speed=speed+0.02 level=level+1 if (level-1)%5==0 then color={225,170,0} elseif (level-1)%5==1 then color={0,0,255} elseif (level-1)%5==2 then color={100,100,100} elseif (level-1)%5==3 then color={90,255,0} elseif (level-1)%5==4 then color={255,255,255} endendfunction on.paint(gc) render(gc) drawPlayer(gc) drawMenu(gc) drawScore(gc) gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",8) gc:drawString("Lua CubeField - Par Loic Pujet",10,200,"top") timer.start(0.01)endfunction on.timer() timer.stop() updateCubes() updateMove() if not menu then score=score+1 if score%1000==0 then levelUp() end end platform.window:invalidate()endfunction on.escapeKey() menu=trueendfunction on.enterKey() if menu then menu=false speed=0.08 moving=false score=0 level=1 color={225,170,0} for i=1,27 do cubesY[i]=cubesY[i]-5 end endendfunction on.arrowLeft() if not menu then dir=-1 moving=true moveStart=timer.getMilliSecCounter() endendfunction on.arrowRight() if not menu then dir=1 moving=true moveStart=timer.getMilliSecCounter() endendfunction on.charIn(ch) if ch=="6" then on.arrowRight() elseif ch=="4" then on.arrowLeft() endend Generated by the BBify'r (http://clrhome.tk/resources/bbify/)
I've just tested and it is quite nice =)the only thing I would say is that the paralax is a bit strange. Closer objects are going slower than Far ones. It is a bit difficult to go between to cubes along Z axis (forward).You really well managed game-events (speed up), but I think you better make it faster to come, don't you think ?I haven't looked at the code yet.
the only thing I would say is that the paralax is a bit strange. Closer objects are going slower than Far ones. It is a bit difficult to go between to cubes along Z axis (forward).
Sorry for double-posting, but...Update ! (again)-There is a nice sprite for the player-The corridor is more regularI just modified the source which Adriweb gave to me, so no need to extract the code this time.I think this is the final release...Jonius7, could you please do another animated screenshot ? Final source code :Spoiler For Spoiler: Quote from: LuaplayerImg=image.new("\020\000\000\000\020\000\000\000\000\000\000\000(\000\000\000\016\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128")cubesX={1,5,7,6,4,6,4,1,3,2,3,7,8,9,1,2,3,4,2,6,7,1,9,1,2,3,4}cubesY={1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9}lastCube=1player=0speed=0.1moving=falsedir=1moveStart=0menu=truescore=0level=1color={225,170,0}rotation=0function render(gc) drawHorizon(gc) local size,x,y,i,polygon for j=1,27 do i=(j+lastCube-2)%27+1 size=cubesY[i]*cubesY[i]/1.5+8 x=(cubesX[i]-7-player)*20*(cubesY[i]*cubesY[i]/20+0.5)-size/2 y=cubesY[i]*cubesY[i]*2-152 polygon=rotate({x,y,x+size,y,x+size,y+size,x,y+size,x,y}) if cubesY[i]>1 then gc:setColorRGB(color[1],color[2],color[3]) gc:fillPolygon(polygon) gc:setColorRGB(0,0,0) gc:drawPolyLine(polygon) end if cubesY[i]>7.5 and cubesY[i]<8.5 then if x<7 and x+size>-7 then on.escapeKey() end end endendfunction rotate(p) local s,c=math.sin(rotation),math.cos(rotation) return {p[1]*c-p[2]*s+159,p[1]*s+p[2]*c+202,p[3]*c-p[4]*s+159,p[3]*s+p[4]*c+202,p[5]*c-p[6]*s+159,p[5]*s+p[6]*c+202,p[7]*c-p[8]*s+159,p[7]*s+p[8]*c+202,p[9]*c-p[10]*s+159,p[9]*s+p[10]*c+202}endfunction updateCubes() local step=menu and 0.06 or speed for i=1,27 do cubesY[i]=cubesY[i]+step if cubesY[i]>10 then if score%1000<800 then cubesX[i]=math.random(10,140)/10+player else cubesX[i]=math.random(10,140)/200+player+(i-1)%2*5+4.1 end cubesY[i]=1 lastCube=lastCube==1 and 27 or lastCube-1 end endendfunction updateMove() if moving then player=player+0.07*dir if math.abs(rotation)<0.1 then rotation=rotation-0.005*dir end if timer.getMilliSecCounter()-moveStart>=150 then moving=false end else if math.abs(rotation)>0.005 then rotation=rotation-0.005*rotation/math.abs(rotation) end endendfunction drawPlayer(gc) if not menu then gc:drawImage(playerImg,149,192) endendfunction drawHorizon(gc) local s,c=math.sin(rotation),math.cos(rotation) gc:setColorRGB(0,0,0) gc:drawLine(s*142-c*200+159,202-c*142-s*200,c*200+s*142+159,s*200-c*142+202)endfunction drawMenu(gc) if menu then gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",30) gc:drawString("CubeField",80,10,"top") gc:setFont("sansserif","b",12) gc:drawString("Press Enter",115,150,"top") local highscore=var.recall("highscore") if not highscore then var.store("highscore",0) highscore=0 end if score>highscore then var.store("highscore",score) document.markChanged() end local str="Score : "..tostring(score).." Highscore : "..tostring(highscore) gc:drawString(str,159-gc:getStringWidth(str)/2,100,"top") endendfunction drawScore(gc) if not menu then gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",12) gc:drawString(tostring(score),2,0,"top") if score%1000>950 then gc:setFont("sansserif","r",30) gc:drawString("Speed Up !",80,10,"top") end endendfunction levelUp() speed=speed+0.02 level=level+1 if (level-1)%5==0 then color={225,170,0} elseif (level-1)%5==1 then color={0,0,255} elseif (level-1)%5==2 then color={100,100,100} elseif (level-1)%5==3 then color={90,255,0} elseif (level-1)%5==4 then color={255,255,255} endendfunction on.paint(gc) render(gc) drawPlayer(gc) drawMenu(gc) drawScore(gc) gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",8) gc:drawString("Lua CubeField - Par Loic Pujet",10,200,"top") timer.start(0.01)endfunction on.timer() timer.stop() updateCubes() updateMove() if not menu then score=score+1 if score%1000==0 then levelUp() end end platform.window:invalidate()endfunction on.escapeKey() menu=trueendfunction on.enterKey() if menu then menu=false speed=0.08 moving=false score=0 level=1 color={225,170,0} for i=1,27 do cubesY[i]=cubesY[i]-5 end endendfunction on.arrowLeft() if not menu then dir=-1 moving=true moveStart=timer.getMilliSecCounter() endendfunction on.arrowRight() if not menu then dir=1 moving=true moveStart=timer.getMilliSecCounter() endendfunction on.charIn(ch) if ch=="6" then on.arrowRight() elseif ch=="4" then on.arrowLeft() endend Generated by the BBify'r (http://clrhome.tk/resources/bbify/)DOWNLOAD
My highscore with the latest version is 5064...
and yes from DJ_O and DT, there is this gap oftentimes which should look passable, but instead the precision of moving left and right isn't great and BAM! game over.
playerImg=image.new("\020\000\000\000\020\000\000\000\000\000\000\000(\000\000\000\016\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\128\000\128\000\128")cubesX={1,5,7,6,4,6,4,1,3,2,3,7,8,9,1,2,3,4,2,6,7,1,9,1,2,3,4}cubesY={1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9}lastCube=1player=0speed=0.1moving=falsedir=1moveStart=0menu=truescore=0level=1color={225,170,0}rotation=0function render(gc) drawHorizon(gc) local size,x,y,i,polygon for j=1,27 do i=(j+lastCube-2)%27+1 size=100/(10-cubesY[i]) x=(cubesX[i]-7-player)/(10-cubesY[i])*150-size/2 y=5/(10-cubesY[i])*50-180 polygon=rotate({x,y,x+size,y,x+size,y+size,x,y+size,x,y}) if cubesY[i]>1 then gc:setColorRGB(color[1],color[2],color[3]) gc:fillPolygon(polygon) gc:setColorRGB(0,0,0) gc:drawPolyLine(polygon) end if y+size>3 and y<17 then if x<6 and x+size>-6 then menu=true end end endendfunction rotate(p) local s,c=math.sin(rotation),math.cos(rotation) return {p[1]*c-p[2]*s+159,p[1]*s+p[2]*c+202,p[3]*c-p[4]*s+159,p[3]*s+p[4]*c+202,p[5]*c-p[6]*s+159,p[5]*s+p[6]*c+202,p[7]*c-p[8]*s+159,p[7]*s+p[8]*c+202,p[9]*c-p[10]*s+159,p[9]*s+p[10]*c+202}endfunction updateCubes() local step=menu and 0.06 or speed for i=1,27 do cubesY[i]=cubesY[i]+step if cubesY[i]>10 then if score%1000<800 then cubesX[i]=math.random(10,140)/10+player else cubesX[i]=math.random(10,140)/200+player+(i-1)%2*5+4.1 end cubesY[i]=1 lastCube=lastCube==1 and 27 or lastCube-1 end endendfunction updateMove() if moving then player=player+0.07*dir if math.abs(rotation)<0.15 or dir==rotation/math.abs(rotation) then rotation=rotation-0.005*dir end if timer.getMilliSecCounter()-moveStart>=150 then moving=false end else if math.abs(rotation)>0.005 then rotation=rotation-0.005*rotation/math.abs(rotation) end endendfunction drawPlayer(gc) if not menu then gc:drawImage(playerImg,149,192) endendfunction drawHorizon(gc) local s,c=math.sin(rotation),math.cos(rotation) gc:setColorRGB(0,0,0) gc:drawLine(s*142-c*200+159,202-c*142-s*200,c*200+s*142+159,s*200-c*142+202)endfunction drawMenu(gc) if menu then gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",30) gc:drawString("CubeField",80,10,"top") gc:setFont("sansserif","b",12) gc:drawString("Press Enter",115,150,"top") local highscore=var.recall("highscore") if not highscore then var.store("highscore",0) highscore=0 end if score>highscore then var.store("highscore",score) document.markChanged() end local str="Score : "..tostring(score).." Highscore : "..tostring(highscore) gc:drawString(str,159-gc:getStringWidth(str)/2,100,"top") endendfunction drawScore(gc) if not menu then gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",12) gc:drawString(tostring(score),2,0,"top") if score%1000>950 then gc:setFont("sansserif","r",30) gc:drawString("Speed Up !",80,10,"top") end endendfunction levelUp() speed=speed+0.02 level=level+1 if (level-1)%5==0 then color={225,170,0} elseif (level-1)%5==1 then color={0,0,255} elseif (level-1)%5==2 then color={100,100,100} elseif (level-1)%5==3 then color={90,255,0} elseif (level-1)%5==4 then color={255,255,255} endendfunction on.paint(gc) render(gc) drawPlayer(gc) drawMenu(gc) drawScore(gc) gc:setColorRGB(0,0,0) gc:setFont("sansserif","r",8) gc:drawString("Lua CubeField - Par Loic Pujet",10,200,"top") timer.start(0.01)endfunction on.timer() timer.stop() updateCubes() updateMove() if not menu then score=score+1 if score%1000==0 then levelUp() end end platform.window:invalidate()endfunction on.enterKey() if menu then menu=false speed=0.1 moving=false score=0 level=1 color={225,170,0} for i=1,27 do cubesY[i]=cubesY[i]-5 end endendfunction on.arrowLeft() if not menu then dir=-1 moving=true moveStart=timer.getMilliSecCounter() endendfunction on.arrowRight() if not menu then dir=1 moving=true moveStart=timer.getMilliSecCounter() endendfunction on.charIn(ch) if ch=="6" then on.arrowRight() elseif ch=="4" then on.arrowLeft() endend Generated by the BBify'r (http://clrhome.tk/resources/bbify/)