`މÎÚD@î<ĸÎ Ú$e8ŠU ,)6‰;]ÉAĶösÎęôôöq8HaōōęâæîމÎÚD@î<ĸÂPÚ$e8ŠUÎÎÖĨšÞ;]ÉAĶöaĘ 00)or(d2>0)or(d3>0) return not(hasNeg and hasPos) end function pointInQuad(px,py,x1,y1,x2,y2,x3,y3,x4,y4) return pointInTriangle(px,py,x1,y1,x2,y2,x3,y3) or pointInTriangle(px,py,x1,y1,x3,y3,x4,y4) end function pointInLine(X,Y,w) local p=math.pi/2 for k=1, #l do for m=1, #l[k]-1 do local A=s[l[k][m]] local Ax=A[1]+segLP[k][m][1] local Ay=A[2]+segLP[k][m][2] local B=s[l[k][m+1]] local Bx=B[1]+segLP[k][m][1] local By=B[2]+segLP[k][m][2] local ang=math.atan(By-Ay,Bx-Ax) local ax=Ax+math.cos(ang+p)*w local ay=Ay+math.sin(ang+p)*w local bx=Ax-math.cos(ang+p)*w local by=Ay-math.sin(ang+p)*w local cx=Bx+math.cos(ang+p)*w local cy=By-math.sin(ang+p)*w local dx=Bx-math.cos(ang+p)*w local dy=By+math.sin(ang+p)*w if pointInQuad(X,Y,ax,ay,bx,by,cx,cy,dx,dy) then return {k,m} end end end end function intersect(x1,y1,x2,y2,x3,y3,x4,y4) local dx1 = x2 - x1 local dy1 = y2 - y1 local dx2 = x4 - x3 local dy2 = y4 - y3 local den=dx1*dy2-dy1*dx2 if den==0 then return nil end local dx3=x3-x1 local dy3=y3-y1 local t=(dx3*dy2-dy3*dx2)/den local u=(dx3*dy1-dy3*dx1)/den if t>=0 and t<=1 and u>=0 and u<=1 then return {x1+t*dx1, y1+t*dy1} end return nil end function overWater(x1,y1,x2,y2) local int={} if mp then for i=1, #m[mp] do for j=1, #m[mp][i]-1 do local t=m[mp][i][j] local u=m[mp][i][j+1] local inter=intersect(x1,y1,x2,y2,t[1],t[2],u[1],u[2]) if inter then int[#int+1]=inter end end end end if #int==0 then int=nil end return int end function dis(x1,y1,x2,y2) return math.sqrt((x2-x1)^2+(y2-y1)^2) end function spawn(type,rand,i) local x local y local name=" " if not i then if rand==nil then rand=false end if mp==2 or #s>=#c[mp] then rand=true end if rand then x=math.random(-SR,SR) x=x-x%20+xrel y=math.random(-SR,SR)-10 y=y-y%20 while pointExists(x,y) do x=math.random(-SR,SR) x=x-x%20+xrel y=math.random(-SR,SR)-10 y=y-y%20 end else local i=math.random(1,#c[mp]) x=c[mp][i][1] y=c[mp][i][2] while pointExists(x,y) do i=math.random(1,#c[mp]) x=c[mp][i][1] y=c[mp][i][2] end name=i end elseif c[mp][i] then x=c[mp][i][1] y=c[mp][i][2] name=i end if not type then type=math.random(1,3) end local j=#s+1 s[j]={x,y,type,{},200+math.random(-100,400),0,name,{}} s[j][7]=name local midLine=pointInLine(x,y,2) if midLine then table.insert(l[midLine[1]],midLine[2]+1,j) end end function rotOffset(x, y, ang) local ca = math.cos(ang) local sa = math.sin(ang) return x*ca - y*sa, x*sa + y*ca end local CX = 120 local CY = 68 function sx(wx) return (wx-CX)*zoom+CX end function sy(wy) return (wy-CY)*zoom+CY end function sr(r) return r*zoom end function wx(sx) return (sx-CX)/zoom + CX end function wy(sy) return (sy-CY)/zoom + CY end function fatLine(x1,y1,x2,y2,r,col,mod,int,ob) if not mod then mod=1 end local j=1 local o=false --Over water local dx=x2-x1 local dy=y2-y1 local d=math.sqrt(dx*dx+dy*dy) if d==0 then return end dx=dx/d dy=dy/d if int then local intD={} for i=1, #int do intD[i]=dis(x1,y1,sx(int[i][1]+x),sy(int[i][2]+y)) end for i=1, #int do for j=1, #int-1 do if intD[j]>intD[j+1] then local first=intD[j] intD[j]=intD[j+1] intD[j+1]=first first=int[j] int[j]=int[j+1] int[j+1]=first end end end end for i=0,d do if int and int[j] then if dis(x1+dx*i,y1+dy*i,sx(int[j][1]+x),sy(int[j][2]+y))<2 then j=j+1 o=not o end end if (not o) or i%mod==0 or mp==2 then circ(x1+dx*i,y1+dy*i,r,col) end end end function zFatLine(x1,y1,x2,y2,r,col,mod,int) if int then for i=1, #int do --int[i][1]=sx(int[i][1]) --int[i][2]=sy(int[i][2]) end end if not col then col=4 end fatLine(sx(x1),sy(y1),sx(x2),sy(y2),sr(r),col,mod,int) end function rotRect(cx, cy, w, h, ang, col, outline) local hw=w/2 local hh=h/2 local ca=math.cos(ang) local sa=math.sin(ang) local function rx(x,y) return cx+x*ca-y*sa,cy+x*sa+y*ca end local x1,y1=rx(-hw,-hh) local x2,y2=rx (hw,-hh) local x3,y3=rx( hw, hh) local x4,y4=rx(-hw, hh) tri(x1,y1,x2,y2,x3,y3,col) tri(x1,y1,x3,y3,x4,y4,col) if outline then line(x1,y1,x2,y2,outline) line(x2,y2,x3,y3,outline) line(x3,y3,x4,y4,outline) line(x4,y4,x1,y1,outline) end end function zRotRect(cx,cy,w,h,ang,col,outline) rotRect(sx(cx),sy(cy),w*zoom,h*zoom,ang,col,outline) end function zCirc(x,y,r,col) circ(sx(x), sy(y), sr(r), col) end function zCircb(x,y,r,col) circb(sx(x), sy(y), sr(r), col) end function zRect(x,y,w,h,col) rect(sx(x), sy(y), w*zoom, h*zoom, col) end function triEq(rot, cx, cy, col1, col2, r) local a1 = rot + (-30)*math.pi/180 local a2 = rot + ( 90)*math.pi/180 local a3 = rot + (210)*math.pi/180 tri( cx + math.cos(a1)*r, cy + math.sin(a1)*r, cx + math.cos(a2)*r, cy + math.sin(a2)*r, cx + math.cos(a3)*r, cy + math.sin(a3)*r, col1 ) if col2 then local r2 = r - 2 tri( cx + math.cos(a1)*r2, cy + math.sin(a1)*r2, cx + math.cos(a2)*r2, cy + math.sin(a2)*r2, cx + math.cos(a3)*r2, cy + math.sin(a3)*r2, col2 ) end end function zTriEq(rot, cx, cy, col1, col2, r) triEq(rot,sx(cx),sy(cy),col1,col2,r*zoom) end function zTri(x1,y1, x2,y2, x3,y3, col) tri(sx(x1),sy(y1),sx(x2),sy(y2),sx(x3),sy(y3),col) end function zSpr(id, x, y, colorkey, scale, flip, rotate, w, h) spr( id, sx(x), sy(y), colorkey or -1, scale or 1, flip or 0, rotate or 0, w or 1, h or 1 ) end function loc() if l[n] and #l[n]>=2 and lLoc[n]==0 then --locomotive {x,y,line,destiny,direction,origin,commuters,timer,overWater,j,o,w} t[#t+1]={s[l[n][1]][1],s[l[n][1]][2],n,l[n][1],1,l[n][2],{},10,{},1,false,0} lLoc[n]=1 end end mode=0 pMode=false function TIC() --banks vbank(0) cls(15) vbank(mode) cls(0) if mp==3 or mp==4 then cls(9) else cls(0) end mx,my,ml=mouse() if ml and not mlp then tPressed=time() end tsPressed=time()-tPressed if initiable then if mx>90+x-400 and mx<90+x-400+60 and my>15+y-90 and my<123+y-90 then txty=(5*txty)/6 txt1={"Redesign the original underground railway, the London tube.", "Replantea el ferrocarril metropolitano original, el Tube de Londres."} txt=txt1[lg] locked=false if mlp and not ml and tsPressed<200 then mp=2 init() end elseif mx>20+x-400 and mx<20+x-400+60 and my>15+y-90 and my<123+y-90 then txty=(5*txty)/6 txt1={"Rebuild the railroads of 19th century American northeast.", "Reconstruye los ferrocarriles del Noreste Americano del siglo XIX"} txt=txt1[lg] locked=false if mlp and not ml and tsPressed<200 then mp=1 init() end elseif mx>160+x-400 and mx<160+x-400+60 and my>15+y-90 and my<123+y-90 then txty=(5*txty)/6 txt1={"Restore Meiji-era railway lines through Japan's mountainous terrain.", "Restaura las lineas ferroviarias de la era de Meiji sobre el terreno rocoso de las islas japonesas."} txt=txt1[lg] locked=false if mlp and not ml and tsPressed<200 then mp=3 tip=0 init() end elseif mx>230+x-400 and mx<230+x-400+60 and my>15+y-90 and my<123+y-90 then txty=(5*txty)/6 txt1={"Route cable cars and ferries across the San Francisco Bay.", "Desarrolla rutas de cable cars y ferries en San Francisco Bay"} if math.max(pmem(1),pmem(2),pmem(3),pmem(4),pmem(5))>=500 then locked=false else locked=true end if allUnlocks then locked=false end --locked=false if locked then txt1={"Score at least 500 in any map to unlock San Francisco", "Consigue al menos 500 puntos en cualquier mapa para desbloquear San Francisco."} end txt=txt1[lg] if not locked and mlp and not ml and tsPressed<200 then mp=4 init() end elseif mx>300+x-400 and mx<300+x-400+60 and my>15+y-90 and my<123+y-90 then txty=(5*txty)/6 txt1={"Connect two continents over the Bosphorus at this storied crossroads.", "Conecta ambos continentes sobre el Bosforo en esta encrucijada historica."} if math.max(pmem(1),pmem(2),pmem(3),pmem(4),pmem(5))>=800 then locked=false else locked=true end --locked=false if allUnlocks then locked=false end if locked then txt1={"Score at least 800 in any map to unlock Istanbul", "Consigue al menos 800 puntos en cualquier mapa para desbloquear Estambul."} end txt=txt1[lg] if not locked and mlp and not ml and tsPressed<200 then mp=5 init() end else txty=(5*txty+15)/6 end else txty=(5*txty+15)/6 end if mp then if keyp(58) then zoom=math.min(zoomMax,zoom+0.1) --if mp==1 then x=x-10 end end if keyp(59) then zoomOut() end end if mp then xMax=55-xrel+70 elseif history then xMax=200 else xMax=400 end if x>xMax and not gameOver or exiting then x=(10*x+xMax)/11 axp=false if math.abs(x-xMax)<0.1 then if mp then x=xMax if tip<1 then tip=1 end elseif not main then --launch() s={} l={} t={} howToTxt=1 initiable=true exiting=false end end end if mp then xMin=55-xrel+70 elseif howTo then xMin=880 elseif history then xMin=200 elseif main then xMin=400 else xMin=270 end if xyMax then y=(y*10+yMax)/11 end if y3+x-400 and mx<3+x-400+16 and my>2+y-90 and my<16+y-90 and not settings and not main then rect(5+x-400,3+y-90,12,12,12) if not ml and mlp then howTo=true initiable=false r=7 end end if not main then if mx>3+x-400 and mx<3+x-400+16 and my>17+y-90 and my<32+y-90 then rect(5+x-400,19+y-90,12,12,12) if not ml and mlp then settings=true spdP=spd gameSpd=0 spd=0 end end y=y+15 if mx>3+x-400 and mx<3+x-400+16 and my>17+y-90 and my<32+y-90 then rect(5+x-400,19+y-90,12,12,12) if not ml and mlp then main=true end end y=y-15 end if mx>17 and mx<3+30 and my>-47+y-90 and my<-34+y-90 then rect(19,-46+y-90,11,11,12) if not ml and mlp then settings=false gameSpd=1 spd=1 end end if howTo then if mx>3+x-400-40 and mx<3+x-400+16-40 and my>2 and my<16 then rect(5+x-400-40,2,12,14,12) if not ml and mlp then howTo=false initiable=false end end end --2+x-400-180,115 if mx>3+x-400-200+#texts[1]*10 and mx<2+x-400-200+#texts[1]*10+15 and my>115 and my<130 then rect(4+x-400-200+#texts[1]*10,115,14,14,12) if not ml and mlp then howToTxt=howToTxt%#texts[1]+1 cir4[11]=false if howToTxt==3 or howToTxt==4 then l[1]={1,2} end end end if mx>3+x-400-227 and mx<2+x-400-227+15 and my>115 and my<130 then rect(4+x-400-227,115,14,14,12) if not ml and mlp then howToTxt=(howToTxt-2)%#texts[1]+1 cir4[11]=false if howToTxt==3 or howToTxt==4 then l[1]={1,2} end end end mx=wx(mx)-x my=wy(my)-y spd=spd+acc if spd>gameSpd then spd=gameSpd end if spd<0 then spd=0 end if tip==1 then cir2[1]={s[2][1],s[2][2],0} tip=2 end if l[1] and tip<5 and not ml and mp then cir2={} tip=5 end if l[1] and tip==6 and not ml then cir2[1]={s[2][1]+15,s[2][2],0} tip=7 end if ( l[1] and #l[1]>=3 or (sLine[3] and indexOf(sLine[3],true)) ) and not ml then cir2={} tip=10 end for i=0, #l do lineAv[i]={false,false,false} if l[i] then for j=1, #l[i] do if s[l[i][j]] then lineAv[i][s[l[i][j]][3]]=true end end end end for i=1, #s do sLine[i]={} for j=1, #l do sLine[i][j]=false sLine[i][0]={} end for j=1, #l do if indexOf(l[j],i) and #l[j]>1 then sLine[i][j]=true sLine[i][0][#sLine[i][0]+1]=j end end end if des and ori then if l[n]==nil then l[n]={ori} end if indexOf(l[n],des)==nil then if midL then table.insert(l[n],indexOf(l[n],ori)+1,des) sfx(0,n*4+40) else if indexOf(l[n],ori)==#l[n] then l[n][#l[n]+1]=des sfx(0,n*4+40) else table.insert(l[n],1,des) sfx(0,n*4+40) end ori=des cap=true end end end --check origin if not ml then ori=nil end if not gameOver then for i=1, #s do if s[i] then if dis(s[i][1],s[i][2],mx,my)=2 then --first local a=l[i][1] local b=l[i][2] local c=math.atan2(s[b][2]-s[a][2],s[b][1]-s[a][1]) if lCap1[i] then c=lCap1[i] end local tx=s[a][1]+x-9*math.cos(c) local ty=s[a][2]+y-9*math.sin(c) if dis(tx,ty,mx+x,my+y)=7 then oc=true end end if oc and not (gameOver or settings) then sfx5=sfx5-1 else sfx(-1,1,1,3) end if sfx5<=0 then sfx(5,50,30,3,10) sfx5=50 end --locomotives for i=#t, 1, -1 do if #l[t[i][3]]<=1 then lLoc[t[i][3]]=0 table.remove(t,i) else local n=indexOf(l[t[i][3]],t[i][4]) if n then if t[i][9] and t[i][9][t[i][10]] and dis(t[i][1],t[i][2],t[i][9][t[i][10]][1],t[i][9][t[i][10]][2])<3 then t[i][11]=not t[i][11] t[i][10]=t[i][10]+1 end if dis(t[i][1],t[i][2],s[t[i][4]][1],s[t[i][4]][2])>0.5*spd+1 then local a=math.atan2(s[t[i][4]][2]-t[i][2] ,s[t[i][4]][1]-t[i][1]) local speed=1 if mp==5 and i==1 then speed=0.4 end t[i][1]=t[i][1]+math.cos(a)*0.5*spd*lSpd*speed t[i][2]=t[i][2]+math.sin(a)*0.5*spd*lSpd*speed else local a=#s[t[i][4]][4]>0 and #t[i][7]<6 --should pick up local B=false--connected to other lines local k=#t[i][7] local m=false local N=1 if sLine[t[i][4]] then m=false for j=1, #l do if j~=t[i][3]--not current line and sLine[t[i][4]][j] --line connected and lineAv[j][t[i][7][k]] --said line has destiny then m=true end end end if lineAv[t[i][3]][t[i][7][k]] then m=false end if mp==5 and i==1 then m=true end while k>0 and t[i][7][k]~=s[t[i][4]][3] and not m do k=k-1 m=false if sLine[t[i][4]] then for j=1, #l do if j~=t[i][3]--not current line and sLine[t[i][4]][j] --line connected and lineAv[j][t[i][7][k]] --said line has destiny then m=true end end end if lineAv[t[i][3]][t[i][7][k]] then m=false end if mp==5 and i==1 then m=true end end for j=1, #l do if j~=t[i][3]--not current line and sLine[t[i][4]][j] --line connected then B=true end end A=a and ((not B) or lineAv[t[i][3]][s[t[i][4]][4][N]]) and not (mp==5 and i==1) while not A and N<=#s[t[i][4]][4] do N=N+1 A=a and ((not B) or lineAv[t[i][3]][s[t[i][4]][4][N]]) and not (mp==5 and i==1) end if A or k>0 then t[i][8]=t[i][8]-1*gameSpd if t[i][8]<=0 then t[i][8]=20 if k>0 then if m and t[i][7][k]~=s[t[i][4]][3] then s[t[i][4]][4][#s[t[i][4]][4]+1]=t[i][7][k] else score=score+1 sfx(1,30+t[i][3],2,1) end table.remove(t[i][7],k) elseif A then t[i][7][#t[i][7]+1]=s[t[i][4]][4][N] table.remove(s[t[i][4]][4],N) sfx(1,30+t[i][3],2,1) end end else --next stop --sfx(4,30+t[i][3],99999,3,5) t[i][8]=10 if #l[t[i][3]]>=2 then if n==#l[t[i][3]] then t[i][5]=-1 elseif n==1 then t[i][5]=1 end t[i][6]=t[i][4] t[i][4]=l[t[i][3]][n+t[i][5]] end if mp==5 and i==1 and t[i][6]==1 then t[i][7]={} --pax romana local slots={1,2,3,4,5,6} for k=1, 6 do t[i][7][k]=math.random(1,2) end end local int=overWater(s[t[i][6]][1],s[t[i][6]][2],s[t[i][4]][1],s[t[i][4]][2]) if int then local intD={} for q=1, #int do intD[q]=dis(t[i][1],t[i][2],int[q][1],int[q][2]) end for index=1, #int do for r=1, #int-1 do if intD[r]>intD[r+1] then local first=intD[r] intD[r]=intD[r+1] intD[r+1]=first first=int[r] int[r]=int[r+1] int[r+1]=first end end end end t[i][9]=int t[i][10]=1 t[i][11]=false end end elseif t[i][4]~=t[i][6] then t[i][4]=t[i][6] else lLoc[t[i][3]]=0 loc(t[i][3]) table.remove(t,i) end end end if des==nil and desp~=nil and #l[n]<=2 then --new line --loc() end --if not ml then for i=1, #l do if l[i] and #l[i]>1 then if not ml then n=i end loc() end end --end --stations worldAv={false,false,false} for i=1, #s do if s[i] then worldAv[s[i][3]]=true end end for i=1, #s do if s[i] then if mp then s[i][5]=s[i][5]-spd elseif howToTxt~=5 or #s[i][4]<12 then local d=9 if howToTxt==1 then d=4 end s[i][5]=s[i][5]-d end if s[i][5]<=0 then s[i][5]=dif local type=math.random(1,3) while (not worldAv[type]) or type==s[i][3] do type=math.random(1,3) end if (mp and not (mp==5 and i==1)) or howToTxt==5 or (howToTxt==1 and #s[i][4]<3 and i~=1) then s[i][4][#s[i][4]+1]=type elseif not (howToTxt==1 and (#s[i][4]<=3) and i~=1) then table.remove(s[i][4],#s[i][4]) end end if #s[i][4]>=7 then s[i][6]=math.min(s[i][6]+0.15*spd,380) elseif s[i][6]>0 then s[i][6]=s[i][6]-0.5*spd else s[i][6]=0 end if s[i][6]>375 and mp then gameOver=true if mp==2 then GOST=" " else GOST=cn[mp][lg][s[i][7]] end acc=-0.05 zoom=(15*zoom+2)/16 x = (x*5+(CX-s[i][1]))/6 y = (y*5+(CY-s[i][2]))/6 end end end st=nil for i=1, #s do if s[i] and dis(s[i][1],s[i][2],mx,my)4 and mp then day=day+0.8*spd end if day>90 then day=1 month=month+1 sfx(1,30,2,1,10) if mp and s and c[mp] and mp~=2 and #s>=#c[mp] then dif=dif-2 end if score>pmem(mp) then pmem(mp,score) end if month%6==0 then for i=1, #sLine do if not indexOf(sLine[i],true) then cir[#cir+1]={s[i][1],s[i][2],1} end end end end if month>12 then month=1 year=year+1 if SR<60 then SR=SR+2 end if year==1831 then spawn(3,false,7) --New York sfx(2,36) cir[#cir+1]={s[3][1],s[3][2],1} tip=6 else if year%5~=0 then if mp==2 or #s<#c[mp] then spawn(math.random(1,3),false) sfx(2,36) cir[#cir+1]={s[#s][1],s[#s][2],1} end elseif year%10==0 then if lines<#col[mp] then lines=lines+1 lMockups[lines]=5 end end end end if tCons and not settings and false then if mlp then dx=(dx-(mxp-mx)*2)/3 end if not ml and mlp and axp and x>xMin and x5 then ax=5 end if ax<-5 then ax=-5 end ax=ax*0.95 if not (des or ori or midL or cap) and math.abs(dx)>1 and ml and mlp then x=(x*2+(x+(dx))*4)/6 axp=true end end mxp=mx --draw --sea fill if f[mp] then local c=9 if mp==3 or mp==4 then c=0 end for i=1, #f[mp] do for j=1, #f[mp][i] do zTri(f[mp][i][j][1]+x,f[mp][i][j][2]+y, m[mp][i][j][1]+x,m[mp][i][j][2]+y, m[mp][i][j+1][1]+x,m[mp][i][j+1][2]+y,c) if f[mp][i][j-1] then zTri(f[mp][i][j][1]+x,f[mp][i][j][2]+y, m[mp][i][j][1]+x,m[mp][i][j][2]+y, f[mp][i][j-1][1]+x,f[mp][i][j-1][2]+y,c) end end end end --coastlines if mp then local c=8 for i=1, #m[mp] do for j=1,#m[mp][i]-1 do local a=m[mp][i][j] local b=m[mp][i][j+1] local r=1 if mp==2 then r=3 end zFatLine(a[1]+x,a[2]+y,b[1]+x,b[2]+y,r,c) end end end if mp==2 then local c=8 for i=1,#m[2][1]-1 do local a=m[2][1][i] local b=m[2][1][i+1] local r=1 if mp==2 then r=2 end zFatLine(a[1]+x,a[2]+y,b[1]+x,b[2]+y,2,9) end end --lines seg={} segL={} sc={} lCap1={} lCap2={} for i=1, #s do sc[i]={} end for i=1,#l do local color if mp then color=col[mp][i] else color=cMenu[i] end if #l[i]>=2 then local a=l[i][1] local b=l[i][2] local c=math.atan2(s[b][2]-s[a][2],s[b][1]-s[a][1]) local C=0 local CS=1 local ang=0 while indexOf(sc[a],c+ang) do if CS==1 then C=C-math.pi/4 CS=-1 else CS=1 end ang=C*CS end c=c+ang sc[a][#sc[a]+1]=c lCap1[i]=c if ori~=l[i][1] or n~=i or midL then zFatLine(s[a][1]+x,s[a][2]+y, s[a][1]+x-9*math.cos(c), s[a][2]+y-9*math.sin(c),1,color) zFatLine(s[a][1]+x-9*math.cos(c),s[a][2]+y-9*math.sin(c), s[a][1]+x-9*math.cos(c) - 4*math.cos(c+math.pi/2), s[a][2]+y-9*math.sin(c) - 4*math.sin(c+math.pi/2),1,color) zFatLine(s[a][1]+x-9*math.cos(c),s[a][2]+y-9*math.sin(c), s[a][1]+x-9*math.cos(c) - 4*math.cos(c-math.pi/2), s[a][2]+y-9*math.sin(c) - 4*math.sin(c-math.pi/2),1,color) end end for j=1,#l[i]-1 do local a=l[i][j] local b=l[i][j+1] local is=indexOfSegment(seg,a,b) if is then segL[is]=segL[is]+1 else is=#segL+1 segL[is]=0 if s[a][1]=2 then local a=l[i][#l[i]] local b=l[i][#l[i]-1] local c=math.atan2(s[b][2]-s[a][2],s[b][1]-s[a][1]) local C=0 local CS=1 local ang=0 while indexOf(sc[a],c+ang) do if CS==1 then C=C+math.pi/4 CS=-1 else CS=1 end ang=C*CS end c=c+ang sc[a][#sc[a]+1]=c lCap2[i]=c if ori~=l[i][#l[i]] or n~=i then zFatLine(s[a][1]+x,s[a][2]+y, s[a][1]+x-9*math.cos(c), s[a][2]+y-9*math.sin(c),1,color) zFatLine(s[a][1]+x-9*math.cos(c),s[a][2]+y-9*math.sin(c), s[a][1]+x-9*math.cos(c) - 4*math.cos(c+math.pi/2), s[a][2]+y-9*math.sin(c) - 4*math.sin(c+math.pi/2),1,color) zFatLine(s[a][1]+x-9*math.cos(c),s[a][2]+y-9*math.sin(c), s[a][1]+x-9*math.cos(c) - 4*math.cos(c-math.pi/2), s[a][2]+y-9*math.sin(c) - 4*math.sin(c-math.pi/2),1,color) end end end --line extension if ori then local mod=1 local int=overWater(s[ori][1],s[ori][2],mx,my) local color if mp then color=col[mp][n] else color=cMenu[n] end if int then --print(#int,10,10) mod=5 end zFatLine(s[ori][1]+x ,s[ori][2]+y,mx+x,my+y,1 ,color ,mod, int ,false) if midL then local a=s[l[n][indexOf(l[n],ori)+1]] if a then mod=1 local int=overWater(a[1],a[2],mx,my) if int then mod=5 end zFatLine(a[1]+x,a[2]+y,mx+x,my+y,1,color,mod,int) end end end for i=#cir,1,-1 do cir[i][3]=cir[i][3]+1.3 if cir[i][3]>200 then table.remove(cir,i) else zCircb(cir[i][1]+x,cir[i][2]+y,cir[i][3],14) end end for i=1, #cir2 do if tip==0 or tip==9 then cir2[i][3]=cir2[i][3]-0.2 else cir2[i][3]=cir2[i][3]+0.2 end local r=cir2[i][3] if r>20 and tip==2 then tip=3 end if r>45 and tip==3 then tip=0 cir2[i][3]=10 end if r<0 and tip==0 then tip=1 end if r<0 and tip==9 then tip=6 end if tip==3 then cir2[i][1]=(30*cir2[i][1]+s[1][1]+0.5)/31 cir2[i][2]=(30*cir2[i][2]+s[1][2]+0.5)/31 end if r>20 and tip==7 then tip=8 end if r>45 and tip==8 then tip=9 cir2[i][3]=10 end if tip==8 then cir2[i][1]=(30*cir2[i][1]+s[3][1]+0.5)/31 cir2[i][2]=(30*cir2[i][2]+s[3][2]-0.5)/31 end if r>10 then r=10 end if mp~=5 then zCircb(cir2[i][1]+x,cir2[i][2]+y,r,14) end end for i=1, #s do if s[i] then local a=s[i][1]+x local b=s[i][2]+y local e=10*r/6 for j=1, math.min(s[i][6],360) do local c=(-90+j)*math.pi/180 local d=(-90+j-1)*math.pi/180 zTri(a,b, a+math.cos(c)*e,b+math.sin(c)*e, a+math.cos(d)*e,b+math.sin(d)*e,13) end if s[i][6]>=360 then zCirc(a,b,e,13) end end end --locomotives for i=1, #t do local lx = t[i][1]+x local ly = t[i][2]+y local lin = t[i][3] local dest = t[i][4] local dx = s[dest][1]-t[i][1] local dy = s[dest][2]-t[i][2] if dx==0 and dy==0 then dx=s[dest][1]-s[t[i][6]][1] dy=s[dest][2]-s[t[i][6]][2] end local ang = math.atan2(dy, dx) local w = 14 local h = 8 local color if mp then color=col[mp][lin] else color=cMenu[lin] end zRotRect(lx,ly,w,h,ang,color,color) if mp~=2 then if t[i][11] or mp==5 and i==1 then t[i][12]=(t[i][12]*5+1)/6 else t[i][12]=(t[i][12]*5+0.5)/6 end end zCirc(lx+math.cos(ang)*w/2*t[i][12],ly+math.sin(ang)*w/2*t[i][12],h/2,color) zCirc(lx-math.cos(ang)*w/2*t[i][12],ly-math.sin(ang)*w/2*t[i][12],h/2,color) if t[i][5]==-1 then ang=ang+math.pi end local pax=t[i][7] local max=math.min(#pax,6) for p=1, max do color=12 if mp and col[mp][lin]==12 then color=7 end local px=((p-1)%3-1)*4 local py=(p<=3) and -2 or 2 local ox,oy=rotOffset(px,py,ang) local wx=lx+ox local wy=ly+oy if pax[p]==1 then zCirc(wx,wy,1,color) elseif pax[p]==2 then zTriEq(ang+math.pi,wx,wy,color,color,2) elseif pax[p]==3 then zRotRect(wx,wy,3,3,ang,color) end end end -- circle 3 if st and ml and not main then cir3[1]=st if mp then cir3[2]=col[mp][n] else cir3[2]=4 end cir3[3]=(cir3[3]*5+7)/6 else cir3[3]=cir3[3]*10/11 end if n<=lines and s[cir3[1]] then zCirc(s[cir3[1]][1]+x ,s[cir3[1]][2]+y ,cir3[3]*r/6,cir3[2]) end --circle 4 --x,y,xf,xy,size,stage,xi,yi if cir4 then local r if cir4[6]==0 then cir4[5]=cir4[5]+0.2 else cir4[5]=cir4[5]-0.2 end if cir4[6]==0 and cir4[5]>22 then cir4[6]=1 end if cir4[6]==1 and cir4[5]<0 then cir4[6]=0 cir4[1]=cir4[7] cir4[2]=cir4[8] cir4[11]=true end if cir4[6]==1 then cir4[1]=(20*cir4[1]+cir4[3])/21 cir4[2]=(20*cir4[2]+cir4[4])/21 end r=cir4[5] if r>10 then r=10 end if cir4[10] and cir4[11] and not main then zCircb(cir4[1]+x,cir4[2]+y,r,cir4[9]) end end --stations for i=1, #s do if s[i] and not s[i][13] then local a=s[i][1]+x local b=s[i][2]+y local e=10 if tip>1 and not indexOf(sLine[i],true) and not gameOver and mp~=1 and not (mp==5 and i==1) and not settings and (sx(a)<0 or sx(a)>240/zoom or sx(b)<0 or sx(b)>136/zoom) then zoomOut(0.002) end --if s[i][6]<360 then --else --zCirc(a,b,e,13) --end if s[i][3]==1 then circ(sx(s[i][1]+x),sy(s[i][2]+y),(r-2)*zoom,12) if i==ori or i==des then circ(sx(s[i][1]+x),sy(s[i][2]+y),(r-2)*zoom-1,12) else circ(sx(s[i][1]+x),sy(s[i][2]+y),(r-2)*zoom-1,0) end elseif s[i][3]==2 then local c if i==ori or i==des then c=12 else c=0 end zTriEq(math.pi,s[i][1]+x,s[i][2]+y,12,c,r) elseif s[i][3]==3 then local rx=s[i][1]+x local ry=s[i][2]+y local R=(r-2)*zoom R=math.floor(R+0.5) rect(sx(rx)-R,sy(ry)-R,R*2,R*2,12) local R2=r-3 local c if i==ori or i==des then c=12 else c=0 end rect(sx(rx)-R+1,sy(ry)-R+1,R*2-2,R*2-2,c) end end end for i=1, #s do if s[i] then --commuters if not gameOver then for j=1, #s[i][4] do local c=14 local d=0 local X=s[i][1]+((j-1)%3+1)*6+x-1 local Y=s[i][2]+y-7+7*math.floor((j-1)/3) if j>=7 then c=8 d=3 end if st==i and (time()-stTime)>100 then c=13 d=8 end if s[i][4][j]==1 then zCirc(X+2,Y+2,2,c) elseif s[i][4][j]==2 then if zoom>1.2 then zTriEq(math.pi,X+2,Y+2,c,c,3) elseif zoom>=1 then zSpr(0+d,X,Y,0) elseif zoom==0.9 then zSpr(16+d,X,Y,0) else zSpr(64+d,X,Y,0) end elseif s[i][4][j]==3 then zRect(X,Y,4.8,4.8,c) end end end end end --mp~=2 and if st and (time()-stTime)>100 then local text if s[st][7]==" " then text=" " else text=cn[mp][lg][s[st][7]] end if not text then text="?" end local color=14 if n and ml then if mp then color=col[mp][n] else color=cMenu[n] end end if text~=" " then rect(sx(s[st][1]+x)-3*#text-2,sy(s[st][2]+y-12)-2,6*#text+3,9,color) end if color==12 then color=14 else color=12 end print(text,sx(s[st][1]+x)-3*#text,sy(s[st][2]+y-12),color,1) if sLine[st][0] then for i=1, #sLine[st][0] do circ(sx(s[st][1]+x)+3*#text+i*5-2,sy(s[st][2]+y-12)+2,3,14) end for i=1, #sLine[st][0] do local color2 if mp then color2=col[mp][sLine[st][0][i]] else color2=cMenu[sLine[st][0][i]] end circ(sx(s[st][1]+x)+3*#text+i*5-2,sy(s[st][2]+y-12)+2,2,color2) end end end --print(math.floor(mx)..", "..math.floor(my),5,18) --print(stTime,5,34) --select screen if not gameOver and not main then local c=12 x=x-70 rect(90+x-400,15+y-90,60,108,7) local txt1={"North","Noreste"} print(txt1[lg],94+x-400,26+y-90,12) txt1={"America","Americano"} print(txt1[lg],94+x-400,32+y-90,12) for i=1, 6 do circ(89+x-400+i*7,42+y-90,2,col[1][i]) end rect(93+x-400,49+y-90,54,54,0) spr(256,92+x-400,49+y-90,0,1,0,0,7,7) c=12 local txt2={"Best: ","Mejor: "} txt2=txt2[lg] if pmem(1)==0 then c=14 end print(txt2..pmem(1),94+x-400,106+y-90,c,false,1,true) print(1830,94+x-400,114+y-90,13,false,1,false) x=x+70 x=x+70 rect(90+x-400,15+y-90,60,108,7) if lg==2 then --print("Islas",94+x-400,26+y-90,12) end txt1={"Japan","Japon"} print(txt1[lg],94+x-400,32+y-90,12) for i=1, #col[3] do circ(89+x-400+i*7,42+y-90,2,col[3][i]) end rect(93+x-400,49+y-90,54,54,0) spr(368,92+x-400,49+y-90,0,1,0,0,7,7) c=12 if pmem(3)==0 then c=14 end print(txt2..pmem(3),94+x-400,106+y-90,c,false,1,true) print(1872,94+x-400,114+y-90,13,false,1,false) x=x-70 x=x+140 rect(90+x-400,15+y-90,60,108,7) print("San",94+x-400,26+y-90,12) print("Francisco",94+x-400,32+y-90,12) for i=1, #col[4] do circ(89+x-400+i*7,42+y-90,2,col[4][i]) end rect(93+x-400,49+y-90,54,54,0) spr(144,92+x-400,49+y-90,0,1,0,0,7,7) c=12 if pmem(4)==0 then c=14 end txt1=txt2..pmem(4) if math.max(pmem(1),pmem(2),pmem(3),pmem(4),pmem(5))<500 and not allUnlocks then txt1={"Locked","Bloqueado"} txt1=txt1[lg] c=12 circ(120+x-400,75+y-90,13,13) spr(222,112+x-400,66+y-90,0,1,0,0,2,2) end print(txt1,94+x-400,106+y-90,c,false,1,true) print(iyear[4],94+x-400,114+y-90,13,false,1,false) x=x-140 x=x+210 rect(90+x-400,15+y-90,60,108,7) txt1={"Istanbul","Estambul"} print(txt1[lg],94+x-400,32+y-90,12) for i=1, #col[5] do circ(89+x-400+i*7,42+y-90,2,col[5][i]) end rect(93+x-400,49+y-90,54,54,0) spr(151,92+x-400,49+y-90,0,1,0,0,7,7) c=12 if pmem(5)==0 then c=14 end txt1=txt2..pmem(5) if math.max(pmem(1),pmem(2),pmem(3),pmem(4),pmem(5))<800 and not allUnlocks then txt1={"Locked","Bloqueado"} txt1=txt1[lg] c=12 circ(120+x-400,75+y-90,13,13) spr(222,112+x-400,66+y-90,0,1,0,0,2,2) end print(txt1,94+x-400,106+y-90,c,false,1,true) print(iyear[5],94+x-400,114+y-90,13,false,1,false) x=x-210 rect(90+x-400,15+y-90,60,108,7) txt1={"London","Londres"} print(txt1[lg],94+x-400,32+y-90,12) for i=1, 4 do circ(89+x-400+i*7,42+y-90,2,col[2][i]) end rect(93+x-400,49+y-90,54,54,0) spr(263,92+x-400,49+y-90,0,1,0,0,7,7) c=12 if pmem(2)==0 then c=14 end print(txt2..pmem(2),94+x-400,106+y-90 ,c,false,1,true) print(iyear[2],94+x-400,114+y-90,13,false,1,false) txtk=#txt*4 local color=7 --if locked then color=1 end rect(0,127+txty,240,15,color) --7 local color=7 if locked then color=2 end rect(0,128+txty,240,15,color) --0 for i=0, 2 do print(txt,5-txtx+txtk*i,130+txty,12,false,1,true) end end txtx=txtx+0.7 if txtx>=txtk then txtx=0 end if (tip>4 or score>0) and not gameOver and mp then uiy=(10*uiy-90)/11 if not gameOver then uiy=uiy+y-90 end if not pMode then txt1={"Score: ","Puntaje: "} print(txt1[lg]..score,22,94+uiy,12,true,1,true) local text=tostring(year) for i=1, #text do spr(32+tonumber(string.sub(text,i,i)),15+5*i,100+uiy,0,1,0,0,1,2) end --for i=0,1 do print(months[lg][month],22,114+uiy,8) --end txt1={"Next rail line in: ","Siguiente avance en: "} local txt=txt1[lg]..year+10-(year+10)%10 if lines<#col[mp] then print(txt,22,121+uiy,14,false,1,true) end if s[ori] then --print(s[ori][7],22,139+uiy,14,false,1,true) end if s[des] then --print(s[des][7],22,147+uiy,14,false,1,true) end end mx,my=mouse() --if not gameOver then uiy=uiy+y-90 end if mx>3 and mx<3+16 and my>93+uiy and my<110+uiy then spr(94,2,89+6+uiy,0,1,0,0,2,2) if not ml and mlp then settings=true spdP=spd gameSpd=0 spd=0 end else spr(62,2,89+6+uiy,0,1,0,0,2,2) end uiy=uiy+6 if not pMode then if mp or tip>4 then local color=13 if dis(mx,my,26,127+uiy)<6 then color=12 if not ml and mlp then if gameSpd>0 then spdP=spd gameSpd=0 spd=0 else if spdP==0 then spdP=1 end gameSpd=spdP spd=spdP end end end if gameSpd>0 then rect(24,124+uiy,3,8,color) rect(28,124+uiy,3,8,color) else tri(30,127+uiy,25,122+uiy,25,132+uiy,color) end local color=13 if dis(mx,my,44,127+uiy)<8 then color=12 if not ml and mlp then if gameSpd<2 then gameSpd=2 spd=2 else gameSpd=1 spd=1 end end end if gameSpd<2 then tri(44,127+uiy,38,122+uiy,38,132+uiy,color) tri(49,127+uiy,43,122+uiy,43,132+uiy,color) else tri(36,127+uiy,42,122+uiy,42,132+uiy,color) tri(41,127+uiy,47,122+uiy,47,132+uiy,color) end end end uiy=uiy-6 else uiy=(10*uiy-140)/11 end if not gameOver then uiy=uiy-y+90 end if mp and not pMode and not gameOver then for i=#col[mp], 1, -1 do local j=#col[mp]-i+1 if not l[j] or #l[j]<=1 then lMockups[j]=(4*lMockups[j]+2)/5 else lMockups[j]=(4*lMockups[j]+6)/5 end local size=lMockups[j] local color=col[mp][j] if j>lines then color=14 end circ(225,140+y-90-i*12,size,color) end end mx,my=mouse() if gameOver then GOY=GOY*20/21 local txt1=GOST if not txt1 then txt1="" end if mp==2 or mp==4 or mp==5 then txt1={"this station","esta parada"} txt1=txt1[lg] end spr(80,75,10+GOY,9,1,0,0,11,2) local txt2={"in ","en "} if mp==2 or mp==4 or mp==5 then txt2[1]="at " end txt2=txt2[lg] txt4={"Overcrowding ","Sobrecarga "} local txt3=txt4[lg]..txt2..txt1 print(txt3,121-2*#txt3+2,33+GOY,0,true,1,true) print(txt3,120-2*#txt3+2,32+GOY,12,true,1,true) txt1={"network","sistema"} txt1=txt1[lg] if mp==2 then txt1="metro" end txt2={"forced your "..txt1.." to shut down.", "ha forzado a tu "..txt1.." a cerrar."} print(txt2[lg],121-2*#txt2[lg]+2,40+GOY,0,true,1,true) print(txt2[lg],120-2*#txt2[lg]+2,39+GOY,12,true,1,true) txt1={" passengers and cargo", " pasajeros y carga"} if mp==2 or mp==4 then txt1={" passengers"," pasajeros"} end txt3={" boarded"," abordaron"} txt2=score..txt1[lg]..txt3[lg] print(txt2,121-2*#txt2+2,93-GOY,0,true,1,true) print(txt2,120-2*#txt2+2,92-GOY,12,true,1,true) if mp then txt1={year-iyear[mp],year} txt1=txt1[lg] txt2={" years",""} if txt1==1 then txt2={" year","."} end txt3={"railway", "ferrocarril"} txt3=txt3[lg] if mp==2 then txt3="metro" end local txt4={"your "..txt3.." over "..txt1..txt2[lg], "tu "..txt3.." hasta "..txt1..txt2[lg]} txt4=txt4[lg] print(txt4,121-2*#txt4+2,100-GOY,0,true,1,true) print(txt4,120-2*#txt4+2,99-GOY,12,true,1,true) end local color=8 if mx>=96 and mx<146 and my>=110+GOY and my<122+GOY then color=9 if mlp and not ml then launch() init() x=125 end end spr(58,80,107-GOY,0,1,2,0,2,2) rect(96,110-GOY,50,12,color) print("Restart",98,113-GOY,12) color=8 if mx>=96 and mx<146 and my>=123+GOY and my<135+GOY then color=9 if mlp and not ml then mp=nil launch() gameOver=false exiting=true end end spr(60,80,120-GOY,0,1,1,0,2,2) rect(96,123-GOY,50,12,color) print("Menu",98,126-GOY,12) else GOY=(GOY*20-200)/21 end --Main Menu y=y-8 spr(375,85+x-400,50+y+40,0,1,0,0,9,2) y=y+320 color=8 local len1={32,37} if mx>=90+x-400 and mx<90+len1[lg]+x-400 and my>=-115+y-90 and my<-103+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then local yi=y launch() main=false y=yi initiable=true end end rect(90+x-400,-114+y-90,len1[lg],12,color) txt1={"Play","Jugar"} print(txt1[lg],94+x-400,-111+y-90,12) spr(60,77+x-400,-117+y-90,0,1,0,0,2,2) y=y+15 color=8 len1={48,54} if mx>=90+x-400 and mx<90+len1[lg]+x-400 and my>=-115+y-90 and my<-103+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then settings=true initiable=false end end rect(90+x-400,-114+y-90,len1[lg],12,color) txt1={"Options","Opciones"} print(txt1[lg],94+x-400,-111+y-90,12) spr(62,77+x-400,-117+y-90,0,1,3,0,2,2) y=y-15 y=y+30 color=8 len1={70,81} if mx>=90+x-400 and mx<90+len1[lg]+x-400 and my>=-115+y-90 and my<-103+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then howTo=true initiable=false r=7 main=false end end rect(90+x-400,-114+y-90,len1[lg],12,color) txt1={"How to play","Instrucciones"} print(txt1[lg],94+x-400,-111+y-90,12) spr(158,75+x-400,-116+y-90,0,1,0,0,2,2) y=y-30 y=y+45 color=8 len1={50,50} if mx>=90+x-400 and mx<90+len1[lg]+x-400 and my>=-115+y-90 and my<-103+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then history=true end end rect(90+x-400,-114+y-90,len1[lg],12,color) txt1={"History","Historia"} print(txt1[lg],94+x-400,-111+y-90,12) spr(92,75+x-400,-116+y-90,0,1,0,0,2,2) y=y-45 if main then local hP={256,263,368,144,151} local hPY={0,148,267,414,547} local hH={"North America","London","Japan","San Francisco","Istanbul"} for i=1, #hP do print(hH[i],sx(238+x-400),sy(-143+y-90)+hy+hPY[i],12) rect(sx(237+x-400),sy(-135+y-90)+hy+hPY[i],64,74,7) rect(sx(241+x-400),sy(-130+y-90)+hy+hPY[i],54,54,0) spr(hP[i],sx(240+x-400),sy(-130+y-90)+hy+hPY[i],0,1,0,0,7,7) end for i=1, #h[1] do print(h[1][i],sx(297+x-400),sy(-140+y-90)+7*i+hy,12,false,1,true) end if mx>413+x-400 and mx<413+x-400+14 and my>-59+y-90 and my<-59+y-90+15 and not tHis then rect(415+x-400,-57+y-90,12,12,12) if ml and mlp then hy=hy-3 end end spr(6,412+x-400,-60+y-90,0,1,0,1,2,2) y=y-17 if mx>413+x-400 and mx<413+x-400+14 and my>-59+y-90 and my<-59+y-90+15 and not tHis then rect(415+x-400,-57+y-90,12,12,12) if ml and mlp then hy=hy+3 end end spr(6,414+x-400,-58+y-90,0,1,0,3,2,2) y=y+17 y=y-97 x=x-190 if mx>sx(413+x-400) and mxsy(-59+y-90) and my416+x-400 and mx<416+x-400+9 and my>-166+y-90-(hy/580*72) and my<-166+y-90-(hy/580*72)+14 or tHis) and my>-166+y-90 and my<-166+y-90+84 then color=5 if ml then hy=hy+(myp-my)*580/72 tHis=true end end rect(417+x-400,-165+y-90-(hy/580*72),9,13,color) end if hy>0 then hy=(0+hy*15)/16 end if hy<-580 then hy=(-580+hy*15)/16 end y=y-320 y=y+8 if not ml then tHis=false end if not mp and not howTo then r=6 if not s[4] then s[4]={-350,140,2,{},200,0," ",{}} s[4][13]=false else s[4][1]=-350 s[4][2]=140 s[4][4]={} s[4][5]=200 end if not s[5] then s[5]={-230,260,1,{},200,0," ",{}} else s[5][1]=-230 s[5][2]=260 s[5][4]={} s[5][5]=200 end if not s[6] then s[6]={-420,140,2,{},200,0," ",{}} else s[6][1]=-420 s[6][2]=140 s[6][4]={} s[6][5]=200 end if not s[7] then s[7]={-200,80,1,{},200,0," ",{}} else s[7][1]=-200 s[7][2]=80 s[7][4]={} s[7][5]=200 end if not s[8] then s[8]={-200,270,1,{},200,0," ",{}} else s[8][1]=-200 s[8][2]=270 s[8][4]={} s[8][5]=200 end if not s[9] then s[9]={-202,120,1,{},200,0," ",{}} s[9][13]=true else s[9][1]=-202 s[9][2]=120 s[9][4]={} s[9][5]=200 s[9][13]=true end if not s[10] then s[10]={-202,270,1,{},200,0," ",{}} else s[10][1]=-202 s[10][2]=270 s[10][4]={} s[10][5]=200 end if not s[11] then s[11]={-127,45,1,{},200,0," ",{}} else s[11][1]=-127 s[11][2]=45 s[11][4]={} s[11][5]=200 end if not s[12] then s[12]={-322,50,1,{},200,0," ",{}} else s[12][1]=-322 s[12][2]=50 s[12][4]={} s[12][5]=200 end if not s[13] then s[13]={-442,170,1,{},200,0," ",{}} else s[13][1]=-442 s[13][2]=170 s[13][4]={} s[13][5]=200 end l[1]={} l[2]={6,4,5} l[3]={8,7} l[4]={11,9,10} l[5]={12,13} zoom=2 end --Settings if not gameOver then if not main then spr(13,2+x-400,18+y-90,0,1,0,0,2,2) spr(6,2+x-400,32+y-90,0,1,0,1,2,2) end if not gameOver then spr(4,16,-48+y-90,0,1,0,0,2,2) txt1={"Back","Regresar"} print(txt1[lg],35,-44+y-90,12) end if false then y=y-15 color=8 if mx>=90 and mx<180 and my>=-130+y-90 and my<-118+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then tCons=not tCons end end local sprn=4 if tCons then sprn=0 end rect(90,-129+y-90,90,12,color) print("Touch controls",94,-126+y-90,12) spr(116+2*mode+sprn,73,-131+y-90,0,1,0,0,2,2) y=y+15 end y=y+85 if-- mx>=90 and mx<180 and mx>=150 and mx<=162 and my>=-130+y-90 and my<-118+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then allUnlocks=not allUnlocks end end local sprn=4 lang={"All unlocks", "Desbloquear"} if lg==2 then print(lang[lg],164,-129+y-90,12) print("todo",164,-123+y-90,12) else print(lang[lg],164,-126+y-90,12) end local sprite=122 if allUnlocks then sprite=120 end spr(sprite,147,-131+y-90,0,1,0,0,2,2) y=y-85 y=y-15 color=8 if mx>=90 and mx<180 and my>=-130+y-90 and my<-118+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then lg=lg%2+1 end end local sprn=4 rect(90,-129+y-90,60,12,color) lang={"Language", "Idioma"} print(lang[lg],94,-126+y-90,12) spr(122+2*lg,73,-131+y-90,0,1,0,0,2,2) y=y+15 color=8 if mx>=90 and mx<150 and my>=-130+y-90 and my<-118+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then cls(0) if mp==3 then if mode==0 then cls(9) else vbank(0) cls(9) end end mode=(mode+1)%2 vbank(mode) end end rect(90,-129+y-90,70,12,color) local txt1={{"Light mode","Dark mode"},{"Modo claro","Modo oscuro"}} print(txt1[lg][mode+1],94,-126+y-90,12) spr(112+2*mode,73,-131+y-90,0,1,0,0,2,2) y=y+15 color=8 if mx>=90 and mx<155 and my>=-130+y-90 and my<-118+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then pMode=not pMode end end rect(90,-129+y-90,65,12,color) local txt1={"Photo mode","Modo foto"} print(txt1[lg],94,-126+y-90,12) sprt=118 if pMode then sprt=116 end spr(sprt,73,-131+y-90,0,1,0,0,2,2) y=y-15 if mp and not gameOver then y=y+10 y=y+10 color=8 if mx>=96 and mx<176 and my>=-115+y-90 and my<-103+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then settings=false gameSpd=spdP spd=spdP end end rect(90,-114+y-90,54,12,color) txt1={"Resume","Reanudar"} print(txt1[lg],94,-111+y-90,12) spr(60,75,-116+y-90,0,1,0,0,2,2) y=y+15 color=8 if mx>=96 and mx<176 and my>=-115+y-90 and my<-103+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then local yi=y launch() init() x=125 settings=false y=yi tip=1 end end rect(90,-114+y-90,54,12,color) txt1={"Restart","Reiniciar"} print(txt1[lg],94,-111+y-90,12) spr(58,75,-115+y-90,0,1,1,0,2,2) color=8 if mx>=96 and mx<125 and my>=-100+y-90 and my<-88+y-90 then if mp==3 then color=13 else color=9 end if mlp and not ml then mp=nil launch() settings=false exiting=true end end rect(90,-99+y-90,34,12,color) txt1={"Exit","Salir"} print(txt1[lg],94,-96+y-90,12) spr(60,73,-102+y-90,0,1,1,0,2,2) y=y-25 y=y-10 end end --How to play if not main then spr(190,2+x-400,2+y-90,0,1,0,0,2,2) txt1={"How to play","Instrucciones"} --print(txt1[lg],22+x-400,5+y-90,12) end spr(6,2+x-400-40,2,0,1,0,0,2,2) txt1={"Play","Jugar"} print(txt1[lg],22+x-400-90,5,12) spr(6,2+x-400-225,115,0,1,1,0,2,2) spr(6,2+x-400-200+#texts[1]*10,115,0,1,0,0,2,2) local X=12+x-400-220 for i=1, #texts[1] do local c=13 if i==howToTxt then c=15 end circ(X+i*10,121,3,c) end if not mp then zoom=1.2 if howToTxt==1 then txt1={"Stations and passengers","Estaciones y pasajeros"} print(txt1[lg],x-400-90-140,20,12) --spr(375,x-400-80,20,0,2,0,0,4,8) if not s[1] then s[1]={-480,-50,2,{},200+math.random(-100,400),0," ",{}} else s[1][1]=(s[1][1]-480)/2 s[1][2]=(s[1][2]-50)/2 end if not s[2] then s[2]={-470,10,1,{2,2,2},200+math.random(-100,400),0," ",{}} end if s[3] then s[3]=nil l[1]={1,2} end --cir4[1]=s[1][1] --cir4[2]=s[1][2] cir4[3]=s[1][1] cir4[4]=s[1][2] cir4[7]=s[2][1]+12 cir4[8]=s[2][2]-4 cir4[9]=14 cir4[10]=true --l={} --l[1]=-400 --spr(375,x-400-80,50,0,1,0,0,4,8) elseif howToTxt==2 then txt1={"Building lines","Construir lineas"} print(txt1[lg],x-400-90-140,20,12) --spr(375,x-400-80,20,0,2,0,0,4,8) if not s[1] then s[1]={-480,-50,2,{},200+math.random(-100,400),0," ",{}} else s[1][1]=(s[1][1]-480)/2 s[1][2]=(s[1][2]-50)/2 end if not s[2] then s[2]={-470,10,1,{2,2,2},200+math.random(-100,400),0," ",{}} end if s[3] then s[3]=nil l[1]={1,2} end cir4[3]=s[1][1] cir4[4]=s[1][2] cir4[7]=s[2][1] cir4[8]=s[2][2] cir4[9]=6 if l[1] and #l[1]>1 then cir4[10]=false else cir4[10]=true end elseif howToTxt==3 then txt1={"Extending lines","Extender lineas"} print(txt1[lg],x-400-90-140,20,12) if not s[1] then s[1]={-470,-20,2,{},200+math.random(-100,400),0," ",{}} else s[1][1]=(s[1][1]-470)/2 s[1][2]=(s[1][2]-20)/2 end if not s[2] then s[2]={-470,10,1,{2,2,2},200+math.random(-100,400),0," ",{}} end if not s[3] then s[3]={-470,-200,3,{},200+math.random(-100,400),0," ",{}} else s[3][1]=(s[1][1]-470)/2 s[3][2]=(s[1][2]-80)/2 end cir4[3]=s[3][1] cir4[4]=s[3][2] cir4[7]=s[1][1] cir4[8]=s[1][2]-8 cir4[9]=6 if l[1] and #l[1]==3 then cir4[10]=false else cir4[10]=true end elseif howToTxt==4 then txt1={"Adding stations","Agregar paradas"} print(txt1[lg],x-400-90-140,20,12) if not s[1] then s[1]={-480,-50,2,{},200+math.random(-100,400),0," ",{}} else s[1][1]=(s[1][1]-480)/2 s[1][2]=(s[1][2]-50)/2 end if not s[2] then s[2]={-470,10,1,{2,2,2},200+math.random(-100,400),0," ",{}} end if not s[3] then s[3]={-460,-50,3,{2,2,2},200+math.random(-100,400),0," ",{}} else s[3][1]=(s[3][1]-460)/2 s[3][2]=(s[3][2]-25)/2 end cir4[3]=s[3][1] cir4[4]=s[3][2] cir4[7]=-475 cir4[8]=-20 cir4[9]=6 if l[1] and #l[1]==3 then cir4[10]=false else cir4[10]=true end elseif howToTxt==5 then txt1={"Overcrowding","Sobrecarga"} print(txt1[lg],x-400-90-140,20,12) --spr(379,x-400-80,20,0,2,0,0,4,8) if not s[1] then s[1]={-480,-50,2,{},200+math.random(-100,400),0," ",{}} else s[1][1]=(s[1][1]-480)/2 s[1][2]=(s[1][2]-50)/2 end if not s[2] then s[2]={-470,10,1,{2,2,2},200+math.random(-100,400),0," ",{}} end if s[3] then s[3]=nil l[1]={1,2} end cir4[10]=false end for i=1, #texts[lg][howToTxt] do print(texts[lg][howToTxt][i],x-400-90-140,28+i*8,12,false,1,true) end end --arrows x if not main then local arx=0 if (not initiable) or howTo then arx=x-400 end if initiable or mp then if key(60) or ml and initiable and mx>189+arx and mx<204+arx and my>1 and my<16 then x=x+5 rect(191+arx,3+y-90,12,12,12) end if key(61) or ml and initiable and mx>211+arx and mx<226+arx and my>1 and my<16 then x=x-5 rect(213+arx,3+y-90,12,12,12) end end spr(6,190+arx,2+y-90,0,1,1,0,2,2) spr(6,210+arx,2+y-90,0,1,0,0,2,2) end mlp=ml orip=ori desp=des myp=my end