0,88?UUUUUUUUUUUUUUUUUUUUUUUUUUUUUU̻̻̻̼UUUUUUUUUU̻̻̻̻UUUUUUUUUU̻̻̻̻̻̼̻˼̼̻̻̻̼̼̼˼˼˼̻˻˼˼˼˻̼̼̼̻̼̻̻̻̻̻̼̼˼̻̻̻̻̻̻̻̻̻̻̻˼˼˼˼˼̻̻̻̻̻̻̻̻˻̻̼̻̼̻̻̻̻̻̻̻˼˼˼̻̻̻̻̻̼̻̻̻̻̻̼̼˼̼̻̼̻̌˻w{wgkfkfkfkfkfkfwwwkfDfkkDfkkDfkDfkDfkDfk{wwwgkDfkfDffffffffDffffffffDfffffDfffffDfffffDffffwwwwwffffDffffkgfDfffDfffDkgfDfffDfffDkgfDfffDkgfDfffDkgfDfffDkgfDfffD{wwwwwgkfffDkgfDfffDkkfffkvGDDffDffkfDffDffkvGDDffDDffDffkvGDDffDffkfkkvGDDffDkvGDDffDkvGDDffDwwwwwwwfDffDffkvGDDffDkffeffffvtDDfgfffVkfffDfgfffVfvtDDfgfDfgfffVfvtDDfgfffVkfffkffvtDDfgffvtDDfgffvtDDfgfwwwwwwwgDfgfffVfvtDDfgffugefvfgFDDDgFgfUwVffgvfgFgfUwVfFDDDgFgfgFgfUwVfFDDDgFgfUwVffgvffffFDDDgFgfFDDDgFgfFDDDgFgfgFgfUwVfgFgfUwVfFDDDgFgfFvgUffvvFdftfffGfwVeffggfffGfwVeFdftfffGfffGfwVeFdftfffGfwVeffggfkgkffFdftfffGFdftfffGFdftfffGfffGfwVefffGfwVeFdftfffGFfwffgffffftDffDfvgfvfffDffDfvgfffftDffDDffDfvgfffftDffDfvgfvfffffvfffvffftDffDffftDffDffftDffDDffDfvgfDffDfvgfffftDffDfffffffffffDDfffffffffffDffffffffffDDfffDffffffffffDDfffffffffffffgffffgfffDDffffffDDffffffDDfffDfffffffDffffffffffDDffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww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gfffffffffffffffoffffffffofffffffffffffffffffffffffffffffffffvwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwgffffffffffffffffofffffffffoffffffffffffffffffffffffffffffffffffvwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwGDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDtwwwwwwwwwwwwwwwwwwwww<-- title: RALLYWIP -- author: DcyD2 -- desc: RACING Pseudo-3d -- site: Not -- license: Free -- version: 07/28/2026 -- script: lua -- title: F1 Racing -- author: DcyD2 & ChatGPT -- VARIABLES -- -------------- -- LES SONS -- -------------- SFX_ENGINE_IDLE=0 SFX_ENGINE_ACCEL=1 SFX_ENGINE_FULL=2 SFX_TYRE=3 SFX_BRAKE=4 engineOn=false ----------------- speed=0 alerteDistance = speed * 240 jump=0 jumpPower=0 airborne=false airTime=0 landingPush=0 landed=0 balloonX=160 balloonY=20 balloonSpeed=0.2 raceStarted=false lapTimer=0 bestLap=0 startedLap=false lapFlash=0 oldLap=0 Lap=0 -- oh bah j'ai fais un tour ! offRoadTimer=0 -- je reste 2s dans l'herbe et apres je remet sur piste offroad=false -- pas dans l'herbe speedOsc=1 startLine=0 startDistance=3000 loaded=false roadWidth=140 -- largeur route carX=120 -- centrage voiture au milieu route maxSpeed=4 scroll=0 roadOffset=0 maxOffset=60 --- 120 centre donc la moitie=limite route va 60 a -60 scrollspeed=0 -- et hop le sprite 1 et 5 donc timer pour la vitesse je crois et frame pou changer le sprite animTimer=0 animFrame=1 playerX=104 playerY=100 CurvePush=0 -- dans le virage ca pousse vers exterieur carTurn=0 -- relief rloute terrainType=0 terrainLength=0 roadHeight=0 decorSequence={9,11,13} -- type, intensité, longueur routePos=0 segmentType=0 segmentLength=0 terrainProgress=0 -- virages roadCurve=0 targetCurve=0 targetHeight=0 roadCurvePos=0 sky={} depart=true route={ -- DEPART FORET RAPIDE 0,0,1200, -- PREMIERE BOSSE 9,3,180, -- RECEPTION + PETITE DESCENTE 4,2,300, -- GRANDE COURBE DROITE RAPIDE 2,3,1200, -- MONTEE AVEUGLE 3,3,700, -- BOSSE EN SOMMET 9,4,220, -- DESCENTE RAPIDE 4,3,900, -- S GAUCHE DROITE 1,3,900, 2,3,1000, -- ENCHAINEMENT DE PETITES BOSSES 9,2,120, 0,0,100, 9,2,120, 0,0,100, -- GRANDE MONTEE EN VIRAGE 5,3,1200, -- CRETE + SAUT 9,3,250, -- DESCENTE TECHNIQUE 7,3,1100, -- EPINGLE GAUCHE 1,3,1300, -- LONGUE COURBE DROITE 2,2,1500, -- BOSSE AVEUGLE 9,4,250, -- COMPRESSIONS 4,3,180, 3,3,180, 4,3,180, -- SECTEUR RAPIDE 0,0,1600, -- VIRAGES MONTAGNE 6,3,1200, 8,3,1100, -- GROS JUMP FINAL 9,4,300, -- DERNIER SECTEUR TECHNIQUE 1,3,900, 2,3,900, 1,2,700, -- ARRIVEE 0,0,1500 } function getNextCorner() local nextPos=routePos+3 if nextPos>#route then nextPos=1 end return route[nextPos], route[nextPos+1] end -------------------------- function drawDecor() local horizon=60+roadHeight+jump for y=horizon,135,3 do local p=(y-horizon)/(136-horizon) local w=20+roadWidth*p local depth=(1-p)^2 local curve=roadCurve*depth local center=120+curve local left=center-w/2 local right=center+w/2 local s=1+p*3 -- taille 1 à 4 -- gauche if y%18==0 then local id=decorSequence[(y//18)%3+1] spr(id,left-24*s,y-16*s,0,1,0,0,s,s) end -- droite if (y+9)%18==0 then spr(90,right+8,y-16*s,0,1,0,0,s,s) end end end -------------- -------------- -------------- function pneuVirage() sfx( SFX_TYRE, "C-2", 5, 2, 10 ) end -------------- function startEngine() if not engineOn then sfx( 0, "C-3", 60, 0, 10 ) engineOn=true end end ----------------------------- function stopEngine() sfx(-1,0) engineOn=false end ---------------------------- function moteurRalenti() sfx( SFX_ENGINE_IDLE, 10, 3, 0, 8 ) end -------------- function moteurAccel() local pitch=10+math.floor(speed) sfx( SFX_ENGINE_ACCEL, pitch, 3, 0, 12 ) end function getVisibleSegments() visibleSegments={} local pos=routePos if pos<1 then pos=1 end for i=1,10 do table.insert(visibleSegments,{ type=route[pos], intensity=route[pos+1], length=route[pos+2] }) pos=pos+3 if pos>#route then pos=1 end end end -------------- function moteurFond() local pitch=70+speed*3 sfx( 2,"c-4", 5, 0, 15 ) end -------------- function frein() -- sfx vire -- end -------------- function getNextSegment() local type=route[routePos] return type end -------------- ----------------------- -- est-ce un virage ?-- ----------------------- function isCorner() local seg=getNextSegment() if seg==1 or seg==2 then return true end return false end ----------------------- if isCorner() and speed>3 then sonVirage() end -------------------------- function initFirstSegment() routePos=1 segmentType=route[1] intensity=route[2]/3 segmentLength=route[3] terrainProgress=0 terrainType=segmentType end function createSky() for i=-10,25 do sky[i]={} for j=0,1 do sky[i][j]=math.random(9,11) end end sky[6][1]=13 end function start() if depart then -- affichage du feux depart for i=0,6 do spr(53,30,60+i*8,0,2,0,0,1,1) spr(53,190,60+i*8,0,2,0,0,1,1) end for i=0,4 do spr(58,80+i*16,60,0,1,0,0,2,2) spr(58,80+i*16,44,0,1,0,0,2,2) end end end createSky() function formatTime(frames) local total=frames/60 local m=math.floor(total/60) local s=math.floor(total%60) local c=math.floor((total-math.floor(total))*100) return string.format("%02d:%02d.%02d",m,s,c) end function nextSegment() routePos=routePos+3 if routePos+2>#route then routePos=1 LapFlash=60 -- 30s a 60 fps if Lap>0 then if bestLap==0 or lapTimer20 then animTimer=0 if animFrame==1 then animFrame=5 else animFrame=1 end end -- afficher le sprite formule1 if braking then spr(49,playerX+CurvePush*4+landingPush,playerY+roadHeight/4+jump,0,1,0,0,4,3) else local carSprite if carTurn==-1 then -- tourne à gauche if animFrame==1 then carSprite=113 else carSprite=161 end elseif carTurn==1 then -- tourne à droite if animFrame==1 then carSprite=117 else carSprite=165 end else -- tout droit carSprite=animFrame end spr(carSprite, playerX+CurvePush*4+landingPush, playerY+roadHeight/4+jump, 0,1,0,0,4,3) end end function controls() braking=false -- Accélérer if btn(4) then speed=speed+0.12 depart=false if not raceStarted then raceStarted=true Lap=1 laptimer=0 end end -- Freiner if btn(5) then speed=speed-0.30 braking=true end -- freinage Auto herbe if offRoad then speed=speed-0.8 end if offRoad then offRoadTimer=offRoadTimer+1 speed=speed-0.5 if speed<2 then speed=2 end else offRoadTimer=0 end -- retour sur la route après 2 secondes if offRoadTimer>120 then playerX=120 offRoadTimer=0 end -- ralentissement naturel si pas d'accélération if not btn(4) and not btn(5) then speed=speed-0.05 end -- blocage a zero if speed<0 then speed=0 -- pas de vitesse negative end -- oscillation uniquement en pleine accélération if speed>=20 then speed=20 speedOsc=-1 end if speed>=19 and btn(4) and speedOsc==-1 then speed=speed-0.4 end if speed<=19 and speedOsc==-1 then speedOsc=1 end if speed>0 then -- direction gauche if btn(2) then playerX=playerX-2 carTurn=1 -- direction droite elseif btn(3) then playerX=playerX+2 carTurn=-1 else carTurn=0 end end -- retour vers le centre --if not btn(0) and not btn(1) then --if roadOffset>0 then -- roadOffset=roadOffset-0.5 --end -- if roadOffset<0 then -- roadOffset=roadOffset+0.5 --end --end -- limite de la route if roadOffset>180 then roadOffset=180 end if roadOffset<-180 then roadOffset=-180 end end function drawSkyDecor() cls(11) local offset=roadOffset+(roadCurve*0.5) local y=24 -- 3e ligne de blocs (0,8,16) for i=-10,25 do for j=1,1 do -- déplacement du décor avec la route local offset=roadOffset+(roadCurve*0.5) local id=sky[i][j] spr(60,balloonX+offset,y+16+roadHeight,0,1,0,0,2,2) spr(62,(balloonX-80)+offset,y-32+j*20+roadHeight,0,1,0,0,2,2) spr(id,i*16+offset,y+j*20+roadHeight,0,1,0,0,2,2) end end end -------------- -------------- -------------- -------------- ----------------------- -- est-ce un virage ?-- ---------------------- startedLap=true segmentType=route[routePos] local intensity=route[routePos+1] segmentLength=route[routePos+2] terrainProgress=0 terrainType=segmentType -- TYPE DE ROUTE -- 0 = ligne droite plate if segmentType==0 then targetCurve=0 targetHeight=0 -- VIRAGES PLATS -- 1 = virage gauche serré elseif segmentType==1 then targetCurve=-180*intensity targetHeight=0 -- 2 = virage droit serré elseif segmentType==2 then targetCurve=180*intensity targetHeight=0 -- RELIEF SEUL -- 3 = montée elseif segmentType==3 then targetCurve=0 targetHeight=-80 -- 4 = descente elseif segmentType==4 then targetCurve=0 targetHeight=40 -- COMBINAISONS -- 5 = montée gauche elseif segmentType==5 then targetCurve=-120*intensity targetHeight=-80 -- 6 = montée droite elseif segmentType==6 then targetCurve=120*intensity targetHeight=-80 -- 7 = descente gauche elseif segmentType==7 then targetCurve=-60*intensity targetHeight=40 -- 8 = descente droite elseif segmentType==8 then targetCurve=60*intensity targetHeight=40 -- 9 = bosse elseif segmentType==9 then targetCurve=0 targetHeight=-120 airborne=true airTime=0 jump=0 end function drawGauge() local cx=35 local cy=35 local r=28 -- fond compteur --rect(0,0,70,40,0) -- arc 180 degrés for a=180,360,4 do local rad=math.rad(a) local x=cx+math.cos(rad)*r local y=cy+math.sin(rad)*r pix(x,y,15) end -- graduations local values={0,40,80,120,160,200} for i,v in ipairs(values) do local angle=180+(v/200)*180 local rad=math.rad(angle) local x1=cx+math.cos(rad)*(r-5) local y1=cy+math.sin(rad)*(r-5) local x2=cx+math.cos(rad)*r local y2=cy+math.sin(rad)*r line(x1,y1,x2,y2,15) end -- aiguille local mph=speed*10 if mph>200 then mph=200 end local angle=180+(mph/200)*180 local rad=math.rad(angle) local ax=cx+math.cos(rad)*(r-8) local ay=cy+math.sin(rad)*(r-8) line(cx,cy,ax,ay,12) circ(cx,cy,2,8) -- affichage vitesse au dessus de l'aiguille local v=math.floor(mph) local txt="" if v<10 then txt="00"..v elseif v<100 then txt="0"..v else txt=""..v end print(txt.. "",cx-8,cy-10,12) print("Mph",cx-8,cy-20,9) end function drawWarning() local distanceRestante = segmentLength - terrainProgress local alerteDistance = speed * 60 if distanceRestante < alerteDistance then local t = route[routePos] local intensite = route[routePos+1] -- droite if t==2 then if intensite==1 then spr(256,110,70,0,1,0,0,2,2) elseif intensite==2 then spr(258,110,70,0,1,0,0,2,2) else spr(260,110,70,0,1,0,0,2,2) end -- gauche elseif t==1 then if intensite==1 then spr(288,110,80,0,1,0,0,2,2) elseif intensite==2 then spr(290,110,70,0,1,0,0,2,2) else spr(292,110,70,0,1,0,0,2,2) end end end end function TIC() -------------------------- -- SON FONCTION VITESSE -- -------------------------- if speed>0 then startEngine() else stopEngine() end ---------------------- if speed<2 then moteurRalenti() elseif speed<8 then moteurAccel() else moteurFond() end ---------------------- --------------- -- SON FREIN -- --------------- if btn(5) then frein() end ------------- -- VIRAGES -- ------------- if (currentSegment==1 or currentSegment==2) and speed>5 then pneuVirage() end ------------- if raceStarted then lapTimer=lapTimer+1 end if not loaded then initFirstSegment() loaded=true end currentSegment=getNextSegment() terrainProgress=terrainProgress+speed if airborne then airTime=airTime+1 -- montée puis descente jump=math.sin(airTime*0.08)*25 -- fin du saut if airTime>80 then airborne=false jump=0 if not landed then -- déviation à la réception landingPush=math.random(-10,10) landed=true end end else jump=0 landed=false end --------------------------- if segmentType==9 then jump=math.sin(terrainProgress*0.12)*jumpPower else jump=0 end if segmentLength==nil then print("ERREUR SEGMENT",routePos) return end if terrainProgress>segmentLength then nextSegment() end roadCurve=roadCurve+(targetCurve-roadCurve)*0.05 -- interpolation douce roadHeight=roadHeight+(targetHeight-roadHeight)*0.05 controls() scroll=scroll+(speed*0.5) startLine=startLine+speed if startLine>5000 then startLine=0 end startDistance=startDistance-speed if startDistance<0 then startDistance=3000 end landingPush=landingPush*0.9 if math.abs(landingPush)<0.1 then landingPush=0 end drawSkyDecor() nextType,nextIntensity=getNextCorner() drawRoad() drawDecor() drawGauge() drawHud() drawWarning() drawObject() start() drawLapBar() end function drawRoad() -- *0.012 le facteur de glisse ! -- if speed>0 then CurvePush=roadCurve*0.012*(speed/10) playerX=playerX-CurvePush else CurvePush=0 end local horizon=60+roadHeight+jump for y=horizon,135 do local p=(y-horizon)/(136-horizon) local w=20+roadWidth*p local depth=(1-p) local curve=roadCurve*(depth^2) if curve>160 then curve=160 end if curve<-160 then curve=-160 end local center=120+curve local left=center-w/2 local right=center+w/2 -- détection herbe if playerX < left or playerX > right then offRoad=true else offRoad=false end local band=((scroll-y*2)//12)%2 local grass local road if band==0 then grass=7 road=6 else grass=7 road=4 end rect(0,y,240,1,grass) -- Route directement contre l'herbe rect(left,y,w,1,road) end end function drawHud() local mph=0 if speed then mph=speed*10 end if mph>200 then mph=200 end print("LAP "..Lap,200,10,12) if lapFlash>0 then spr(54,104,20,0,1,0,0,2,2) spr(54,120,20,0,1,0,0,2,2) lapFlash=lapFlash-1 end print("RECORD: "..formatTime(bestLap),150,30,12) print("TIME: "..formatTime(lapTimer),150,20,15) end -- fermeture de drawHUD function drawLapBar() local totalSegments = #route / 3 local currentSegment = (routePos -1) / 3 -- fond rect(70,8,100,5,5) -- largeur de la barre local w = (currentSegment / totalSegments) * 100 -- remplissage rect(70,8,w,5,10) end