rendered paste body--[[burnin]]----speed stuffspeed = 250boostspeed = 290curspeed = 0boostfactor = .02--[[System.irdaWrite(string)hi = System.irdaRead()]]--carX=50carY=152oponX=310oponY=152System.usbDiskModeActivate()System.irdaInit()car = Image.load("car.png")bg = Image.load("bg.png")red = Color.new(255,0,0)white = Color.new(255,255,255)function collisionCheck(objectX, objectY, objectWidth, objectHeight, object2X, object2Y, object2Width, object2Height) ax1 = objectX ax2 = objectX + objectWidth ay1 = objectY ay2 = objectY + objectHeight bx1 = object2X bx2 = object2X + object2Width by1 = object2Y by2 = object2Y + object2Height if(ax1 > bx1 and ax1 < bx2 and ay1 > by1 and ay1 < by2) then return true -- the top left corner of object 1 is in object 2 if(ax2 > bx1 and ax2 < bx2 and ay1 > by1 and ay1 < by2) then return true -- the top right corner of object 1 is in object 2 if(ax1 > bx1 and ax1 < bx2 and ay2 > by1 and ay2 < by2) then return true -- the bottom left corner of object 1 is in object 2 if(ax2 > bx1 and ax2 < bx2 and ay2 > by1 and ay2 < by2) then return true -- the bottom right corner of object 1 is in object 2 return falseendbgX = 0carX = (480-car:width())/2distance = 0boost = 100opon = caropondistance = -(272/2)input = Controls.read()while true dooldinput = inputinput = Controls.read()if input:select() then break endif input:r() thenif math.floor(boost) > 0 thencurspeed = curspeed + speed*boostfactorboost = boost - curspeed / 100 / 5elseboost = 0endendif input:cross() and oldinput:cross() and curspeed < speed+1 and ((not input:r()) or (math.floor(boost) < 1 and input:r() )) thencurspeed = curspeed + speed/5/(curspeed+1)if curspeed >= speed then curspeed = speed endelse--boost has made the mph higher than max, but is not currently boostingcurspeed = curspeed - speed/5/(curspeed+1)*3endif not input:cross() and not input:r() thencurspeed = curspeed - speed/5/(curspeed+1)*2endif curspeed <0 then curspeed = 0 endif curspeed >= boostspeed then curspeed = boostspeed enddistance = distance + curspeed / 5bgX = bgX + curspeed / 15analog = input:analogX()if analog < 25 and analog > -25 then analog = 0 end--[[if input:left() thencarX = carX - analogx/20elseif input:right() thencarX = carX + analogy/20end]]--carX = carX + analog/20screen:print(0,40,analog,Color.new(255,255,255))if bgX<=-272 thenbgX = 0endif bgX>1 thenbgX = bgX -271endboost = boost + curspeed / 1000 / 5if boost >100 thenboost = 100endif boost < 0 then boost = 0 endopondistance = opondistance +14 + curspeed/5/2 + math.random(-3,3)--[[System.irdaWrite(distance)screen.waitVblankStart()--read the IrDa port, and backup the varsoldopondistance = opondistanceopondistance = tostring(System.irdaRead())screen.waitVblankStart()if opondistance == "nil" thenopondistance = oldopondistanceendopondistance = tonumber(opondistance)if opondistance == nil thenopondistance = oldopondistanceend]]--if carX + carY = oponX + oponY then curspeed=100endif distance==100000 thenscreen:print(100, 100, "Collision!", red)endscreen:clear()screen:blit(0,bgX,bg)screen:blit(0,bgX+bg:height(),bg)screen:blit(480/2+50,distance-opondistance+110,opon)screen:blit(carX,152,car)screen:print(0,0,"Distance Traveled: "..distance.." pixels",white)screen:print(0,10,"Current Speed: "..math.floor(curspeed).."km/h",white)screen:print(0,20,"Opponant at: "..math.floor(distance-opondistance).." Distance: "..opondistance,white)screen:print(1,271-5-10,math.floor(boost),white)screen:fillRect(1,271-5,boost,5,Color.new(255,0,0))screen.waitVblankStart()screen.flip()end