SHOW:
|
|
- or go back to the newest paste.
| 1 | local file = fs.open("lgame/lgame","r")
| |
| 2 | if file then | |
| 3 | file.close() | |
| 4 | - | os.loadAPI('/lg/lg')
|
| 4 | + | |
| 5 | - | lg.setup('term')
|
| 5 | + | |
| 6 | - | os.loadAPI("uap")
|
| 6 | + | |
| 7 | local im1 = fs.open("/drivegame/car.nfp","r")
| |
| 8 | if im1 then | |
| 9 | - | lg.fillScreen(colors.black) |
| 9 | + | |
| 10 | else | |
| 11 | lgamec.drawText(1,6,colors.white,colors.black,"Downloading sprites...") | |
| 12 | shell.run("pastebin","get","EnnsawZd","/drivegame/archive")
| |
| 13 | lgamec.drawText(1,6,colors.white,colors.black,"Downloading sprites... DONE") | |
| 14 | - | lg.drawText(1,6,colors.white,colors.black,"Downloading sprites...") |
| 14 | + | lgamec.drawText(1,7,colors.white,colors.black,"Unpacking...") |
| 15 | local arch = fs.open("archive/archive","r")
| |
| 16 | - | lg.drawText(1,6,colors.white,colors.black,"Downloading sprites... DONE") |
| 16 | + | |
| 17 | - | lg.drawText(1,7,colors.white,colors.black,"Unpacking...") |
| 17 | + | shell.run("pastebin", "get", "dp5ri2TJ" ,"archive/archive")
|
| 18 | lgamec.drawText(1,7,colors.red,colors.black,"Restart the game!") | |
| 19 | os.sleep(4) | |
| 20 | - | lg.drawText(1,7,colors.red,colors.black,"DOWNLOAD ARCHIVE FROM UPDATER!") |
| 20 | + | |
| 21 | end | |
| 22 | shell.run("archive/archive unpack","/drivegame/archive","/drivegame/")
| |
| 23 | lgamec.drawText(1,7,colors.white,colors.black,"Unpacking... DONE") | |
| 24 | os.sleep(2) | |
| 25 | - | lg.drawText(1,7,colors.white,colors.black,"Unpacking... DONE") |
| 25 | + | |
| 26 | os.sleep(1) | |
| 27 | lgamec.fillScreen(colors.black) | |
| 28 | ||
| 29 | - | lg.fillScreen(colors.black) |
| 29 | + | |
| 30 | if lgamec.getSize().x < 51 then | |
| 31 | lgamec.drawText(1,7,colors.red,colors.black,"ONLY FOR COMPUTERS!") | |
| 32 | - | if lg.getSize().x < 51 then |
| 32 | + | |
| 33 | - | lg.drawText(1,7,colors.red,colors.black,"ONLY FOR COMPUTERS!") |
| 33 | + | |
| 34 | - | lg.drawText(1,8,colors.red,colors.black,"pastebin run XLpDdvX4") |
| 34 | + | |
| 35 | lgamec.fillScreen(colors.black) | |
| 36 | lgamec.lggSetDefBG(colors.black) | |
| 37 | scene = lgamec.createScene(1,1,lgamec.getSize().x,lgamec.getSize().y,false) | |
| 38 | scene:draw() | |
| 39 | scene:fillScreen(colors.white) | |
| 40 | scene:drawText(2,2,colors.black,colors.white," RACING GAME | TIMUZKAS") | |
| 41 | scene:drawBT("start",2,20,5,8,colors.white,colors.black," Start")
| |
| 42 | while true do | |
| 43 | local event, button, x, y = os.pullEvent( "mouse_click" ) | |
| 44 | if scene:isButton(x,y) == "start" then | |
| 45 | scene:hide() | |
| 46 | break | |
| 47 | else | |
| 48 | end | |
| 49 | end | |
| 50 | game = lgamec.createScene(1,1,lgamec.getSize().x,lgamec.getSize().y) | |
| 51 | game:fillScreen(colors.brown) | |
| 52 | game:drawSprite("road",2,1,"/drivegame/road.nfp")
| |
| 53 | cary = lgamec.getSize().y-5 | |
| 54 | game:drawSprite("car",12,cary,"/drivegame/car.nfp")
| |
| 55 | - | game:drawSprite("road",2,1,shell.dir().."/road.nfp")
|
| 55 | + | |
| 56 | lane = 1 | |
| 57 | - | game:drawSprite("car",12,cary,shell.dir().."/car.nfp")
|
| 57 | + | |
| 58 | while true do | |
| 59 | local event, key = os.pullEvent("key")
| |
| 60 | if key == keys.d then | |
| 61 | if lane < 3 then | |
| 62 | lane = lane + 1 | |
| 63 | end | |
| 64 | elseif key == keys.a then | |
| 65 | if lane > 1 then | |
| 66 | lane = lane - 1 | |
| 67 | end | |
| 68 | end | |
| 69 | end | |
| 70 | end | |
| 71 | function loosef() | |
| 72 | game:hide() | |
| 73 | lgamec.fillScreen(colors.red) | |
| 74 | lgamec.drawText(1,lgamec.getSize().y/2,colors.white,colors.red,"YOU DIED!") | |
| 75 | os.sleep(1) | |
| 76 | lgamec.clearScreen() | |
| 77 | lgamec.setCursorPos(1,1) | |
| 78 | end | |
| 79 | function winf() | |
| 80 | game:hide() | |
| 81 | lgamec.fillScreen(colors.green) | |
| 82 | lgamec.drawText(1,lgamec.getSize().y/2,colors.white,colors.red,"YOU WON!") | |
| 83 | os.sleep(1) | |
| 84 | lgamec.clearScreen() | |
| 85 | lgamec.setCursorPos(1,1) | |
| 86 | end | |
| 87 | lanes2 = {t1 = {16,16,15,15,14,14,13,13,12,12,12},
| |
| 88 | t2 = {26,26,26,26,26,26,26,26,26,26,26},
| |
| 89 | t3 = {34,35,35,36,36,37,37,38,38,39,39}}
| |
| 90 | - | lanes2 = {t1 = {16,16,15,15,14,14,13,13,12,12},
|
| 90 | + | |
| 91 | - | t2 = {26,26,26,26,26,26,26,26,26,26},
|
| 91 | + | |
| 92 | - | t3 = {34,35,35,36,36,37,37,38,38,39}}
|
| 92 | + | |
| 93 | game:moveSprite("in"..linen,inlane[line],2,false)
| |
| 94 | os.sleep(slt) | |
| 95 | end | |
| 96 | end | |
| 97 | game:drawSprite("car2",lanes2["t1"][1],5,"/drivegame/car2.nfp")
| |
| 98 | local ii = 2 | |
| 99 | sleept = 0.8 | |
| 100 | - | game:drawSprite("car2",lanes2["t1"][1],5,"car2.nfp")
|
| 100 | + | |
| 101 | local l2 = "t1" | |
| 102 | loose = false | |
| 103 | lvl = 1 | |
| 104 | function gamef() | |
| 105 | while true do | |
| 106 | ii = ii + 1 | |
| 107 | game:moveSprite("car2",lanes2[l2][ii],2+ii,true)
| |
| 108 | game:moveSprite("car",lanel[lane],cary,true)
| |
| 109 | lgamec.fillScreen(colors.brown) | |
| 110 | game:moveSprite("road",2,1)
| |
| 111 | game:moveSprite("car2",lanes2[l2][ii],2+ii)
| |
| 112 | game:moveSprite("car",lanel[lane],cary)
| |
| 113 | game:drawText(1,lgamec.getSize().y,colors.black,colors.white,"SCORE: "..score.." | LVL: "..lvl.." | "..sleept) | |
| 114 | os.sleep(sleept) | |
| 115 | if (ii == 9) then | |
| 116 | if game:isColiding("car","car2") then
| |
| 117 | loose = true | |
| 118 | break | |
| 119 | else | |
| 120 | ii = 2 | |
| 121 | nl2 = math.random(1,3) | |
| 122 | l2 = "t"..tostring(nl2) | |
| 123 | if (sleept < 0.2) then | |
| 124 | sleept = 0 | |
| 125 | else | |
| 126 | sleept = sleept - 0.2 | |
| 127 | end | |
| 128 | score = score + 1 | |
| 129 | if (sleept == 0 ) then | |
| 130 | break | |
| 131 | end | |
| 132 | end | |
| 133 | end | |
| 134 | end | |
| 135 | end | |
| 136 | parallel.waitForAny(gamef,control) | |
| 137 | game:drawSprite("car3",lanes2["t3"][1],5,"drivegame/car2.nfp")
| |
| 138 | function gamef2() | |
| 139 | local ii = 2 | |
| 140 | sleept = 0.8 | |
| 141 | local l2 = "t1" | |
| 142 | local l22 = "t3" | |
| 143 | loose = false | |
| 144 | while true do | |
| 145 | ii = ii + 1 | |
| 146 | game:moveSprite("car2",lanes2[l2][ii],2+ii,true)
| |
| 147 | game:moveSprite("car3",lanes2[l22][ii],2+ii,true)
| |
| 148 | game:moveSprite("car",lanel[lane],cary,true)
| |
| 149 | lgamec.fillScreen(colors.brown) | |
| 150 | game:moveSprite("road",2,1)
| |
| 151 | game:moveSprite("car2",lanes2[l2][ii],2+ii)
| |
| 152 | game:moveSprite("car2",lanes2[l22][ii],2+ii)
| |
| 153 | game:moveSprite("car",lanel[lane],cary)
| |
| 154 | game:drawText(1,lgamec.getSize().y,colors.black,colors.white,"SCORE: "..score.." | LVL: "..lvl) | |
| 155 | os.sleep(sleept) | |
| 156 | if (ii == 9) then | |
| 157 | if game:isColiding("car","car2") or game:isColiding("car","car3") then
| |
| 158 | loose = true | |
| 159 | break | |
| 160 | else | |
| 161 | ii = 2 | |
| 162 | nl2 = math.random(1,3) | |
| 163 | l2 = "t"..tostring(nl2) | |
| 164 | repeat | |
| 165 | nl22 = math.random(1,3) | |
| 166 | l22 = "t"..tostring(nl22) | |
| 167 | until l22 ~= l2 | |
| 168 | if (sleept < 0.21) then | |
| 169 | sleept = 0 | |
| 170 | else | |
| 171 | sleept = sleept - 0.2 | |
| 172 | end | |
| 173 | score = score + 1 | |
| 174 | if (sleept == 0 ) then | |
| 175 | break | |
| 176 | end | |
| 177 | end | |
| 178 | end | |
| 179 | end | |
| 180 | end | |
| 181 | if loose then | |
| 182 | loosef() | |
| 183 | else | |
| 184 | lvl = 2 | |
| 185 | parallel.waitForAny(gamef2,control) | |
| 186 | if (loose) then | |
| 187 | loosef() | |
| 188 | else | |
| 189 | winf() | |
| 190 | end | |
| 191 | end | |
| 192 | lgamec.exit() | |
| 193 | else | |
| 194 | term.clear() | |
| 195 | term.setCursorPos(1,2) | |
| 196 | term.write("Installing lgame...!")
| |
| 197 | shell.run("pastebin", "get", "z3p689g1" ,"lgame/lgame")
| |
| 198 | os.sleep(1) | |
| 199 | - | term.write("Install lgame from updater!")
|
| 199 | + | |
| 200 | - | uap.upd() |
| 200 | + | term.write("Restart the game!")
|
| 201 | end |