Recent

Author Topic: A playable game - RetroLEM  (Read 708 times)

TBMan

  • Full Member
  • ***
  • Posts: 161
A playable game - RetroLEM
« on: March 31, 2025, 01:52:33 am »
This is an attempt to clone the old Lunar Lander game from 1979 - here's a demo of the original:

  https://www.youtube.com/watch?v=UdheQXhZzWU

My game doesn't have the scalable landscape, although I did figure out how to do something similar, but collision detection with polygons is out of my reach right now. I have some ideas on how to "cheat" my way through it, so there might be a remake of this down the road.

Here's my game. It has 3 difficulty levels and maintains the high score.

Code: Pascal  [Select][+][-]
  1. program RetroLEM;
  2. // 3/29/25
  3. uses
  4.   Windows,
  5.   ptccrt,                 // keep this order of units
  6.   ptcgraph,
  7.   SysUtils,
  8.   Math,
  9.   dos;
  10.  
  11. const
  12.   gravitycyclemax = 8000;
  13.   thrustCycleMax = 5000;
  14.  
  15.  
  16.   MaxPoints = 23;
  17.   Filename = 'LEMHScore.HS';
  18.  
  19. type
  20.   VideoPages = (Page0, Page1);
  21.  
  22.   SkillLevelType = (Easy, Medium, Hard);
  23.  
  24. const
  25.   LevelAdjustment: array[Easy..Hard] of single = (0.70, 0.80, 1.0);
  26.   LevelChars: set of char = ['E', 'e', 'M', 'm', 'H', 'h'];
  27.   FuelLevels: array[easy..hard] of single = (1500, 1400, 1300);
  28.   LevelWidth:array[Easy..Hard] of byte = (40,25,15);
  29.  
  30.  
  31. type
  32.  
  33.  
  34.   trect = record
  35.     x1, y1,
  36.     x2, y2: integer;
  37.   end;
  38.  
  39.   TSinglePoint = record
  40.     x, y: single;
  41.   end;
  42.  
  43.   LemLanderType = record
  44.     points: array[0..MaxPoints] of tsinglepoint;
  45.     CenterX,
  46.     CenterY: single
  47.   end;
  48.  
  49.   HighPointsType = record
  50.     HPoints: single;
  51.   end;
  52.  
  53.  
  54. var
  55.  
  56.   DegreePoints:array[0..360] of byte;
  57.   Level: SkillLevelType;
  58.  
  59.   Hscore: HighPointsType;
  60.  
  61.  
  62.   dir: searchrec;
  63.   HighScoreFile: file of HighPointsType;
  64.  
  65.   TheLem: LemLanderType;
  66.  
  67.   Page: VideoPages = Page0;
  68.  
  69.  
  70.   LandingPadRect, LemRect, mainrect, inforect: Trect;
  71.  
  72.   ThrustCycle, gravitycycle: longint;
  73.  
  74.   gdriver, gmode: smallint;
  75.  
  76.   Points: single = 100;
  77.   FuelBonus,DistanceBonus,
  78.   CenterScoreAdjustment, Speed, Fuel, SideThruster, SideThrust,
  79.   Inertia, thrust, OldXposition, OldYPosition, xposition, yposition,
  80.   gravity: single;
  81.  
  82.  
  83.   PadX, Degrees, TotalDegrees, xpos, ypos: integer;
  84.  
  85.   GoodLanding: boolean = False;
  86.   OutOfBounds: boolean = False;
  87.  
  88.   InfoString: string;
  89.  
  90.   Key: char;
  91.  
  92.  
  93.  
  94. Function AddStrLen(s:string;NewLen:integer):string;
  95. begin
  96.    if length(s)< NewLen then
  97.         while length(s) < NewLen do s := ' '+s;
  98.  result := s;
  99. end;
  100.  
  101. procedure SetTRect(var T: Trect; X, Y, XX, YY: integer);
  102.   begin
  103.     with T do
  104.     begin
  105.       X1 := X;
  106.       Y1 := Y;
  107.       X2 := XX;
  108.       Y2 := YY;
  109.     end;
  110.   end;
  111.  
  112.  
  113.   function PositionInRect(PX, PY: integer; Rect: Trect): boolean;
  114.   begin
  115.  
  116.     PositionInRect := (Px >= Rect.X1) and (Px <= Rect.X2) and
  117.       (Py >= Rect.Y1) and (PY <= Rect.Y2);
  118.  
  119.   end;
  120.  
  121.   function RectInRect(SmallRect, Bigrect: Trect): boolean;
  122.   begin
  123.  
  124.     Result := (SmallRect.x1 >= BigRect.X1) and (SmallRect.Y1 >=
  125.       BigRect.Y1) and (SmallRect.X2 <= bigrect.x2) and
  126.       (SmallRect.Y2 <= BigRect.Y2);
  127.   end;
  128.  
  129.   procedure rotatepoint(var P: Tsinglepoint; deg, centerx, centerY: float);
  130.   var
  131.     newx, newy, angle: float;
  132.     cx, cy, y, x: single;
  133.   begin
  134.     angle := degTorad(deg);
  135.     cx := centerx;
  136.     cy := centery;
  137.     x := p.x;
  138.     y := p.y;
  139.     x := x - cx;
  140.     Y := y - cy;
  141.     newx := (x * cos(angle)) - (y * sin(angle));
  142.     newy := (x * sin(angle)) + (y * cos(angle));
  143.     newx := newx + cx;
  144.     newy := newy + cy;
  145.     p.x := newx;
  146.     p.y := newy;
  147.   end;
  148.  
  149.   procedure rotatelem(deg: float);
  150.   var
  151.     index: integer;
  152.   begin
  153.     for index := 0 to MaxPoints do
  154.       rotatepoint(TheLem.points[index], deg, TheLem.centerx, TheLem.centery);
  155.   end;
  156.  
  157.  
  158.  
  159.  
  160.   procedure SetLem;
  161.   begin
  162.     with TheLem do
  163.     begin
  164.       CenterX := Xpos;
  165.       CenterY := Ypos;
  166.  
  167.       // main base
  168.       Points[0].X := CenterX - 3;
  169.       Points[0].y := CenterY - 1;
  170.       Points[1].X := CenterX + 3;
  171.       Points[1].Y := CenterY - 1;
  172.       Points[2].x := CenterX - 3;
  173.       Points[2].Y := CenterY + 1;
  174.       Points[3].X := CenterX + 3;
  175.       Points[3].Y := CenterY + 1;
  176.  
  177.       //top
  178.  
  179.       Points[4].X := CenterX - 1;
  180.       Points[4].Y := CenterY - 1;
  181.       Points[5].X := CenterX - 3;
  182.       Points[5].Y := CenterY - 3;
  183.       Points[6].x := centerX - 3;
  184.       Points[6].Y := CenterY - 5;
  185.       Points[7].x := CenterX - 1;
  186.       Points[7].y := CenterY - 7;
  187.       Points[8].X := CenterX + 1;
  188.       Points[8].y := CenterY - 7;
  189.       Points[9].x := CenterX + 3;
  190.       Points[9].Y := CenterY - 5;
  191.       Points[10].x := CenterX + 3;
  192.       Points[10].Y := CenterY - 3;
  193.       Points[11].x := CenterX + 1;
  194.       Points[11].Y := CenterY - 1;
  195.  
  196.       // right leg
  197.       Points[12].x := CenterX + 1;
  198.       Points[12].y := CenterY + 1;
  199.       Points[13].X := CenterX + 3;
  200.       Points[13].Y := CenterY + 3;
  201.       Points[14].X := CenterX + 2;
  202.       Points[14].Y := CenterY + 3;
  203.       Points[15].X := CenterX + 4;
  204.       Points[15].y := CenterY + 3;
  205.  
  206.       // left leg
  207.       Points[16].x := CenterX - 1;
  208.       Points[16].Y := CenterY + 1;
  209.       Points[17].x := CenterX - 3;
  210.       Points[17].Y := CenterY + 3;
  211.       Points[18].x := CenterX - 4;
  212.       Points[18].Y := CenterY + 3;
  213.       Points[19].X := CenterX - 2;
  214.       Points[19].y := CenterY + 3;
  215.  
  216.       // thruster setup
  217.  
  218.       Points[20].x := CenterX - 2;
  219.       Points[20].Y := CenterY + 1;
  220.       Points[21].x := CenterX;
  221.       Points[21].Y := CenterY + 8;
  222.       Points[22].X := CenterX + 2;
  223.       Points[22].y := CenterY + 1;
  224.       Points[23].X := CenterX;
  225.       Points[23].Y := CenterY + 8;
  226.  
  227.     end;
  228.   end;
  229.  
  230.   procedure AdjustLEM;
  231.   var
  232.     index: integer;
  233.     Xc, Yc: Float;
  234.   begin
  235.     Xc := Xposition - OldXPosition;
  236.     Yc := YPosition - OldYPosition;
  237.     TheLem.centerX := TheLem.CenterX + XC;
  238.     TheLem.CenterY := TheLem.CenterY + YC;
  239.     for index := 0 to MaxPoints do
  240.       with TheLem do
  241.       begin
  242.         Points[index].X := Points[index].x + xc;
  243.         Points[Index].y := Points[index].y + yc;
  244.       end;
  245.   end;
  246.  
  247.  
  248.   procedure DrawLem;
  249.   var
  250.     i: integer;
  251.   begin
  252.     Setcolor(7);
  253.     AdjustLem;
  254.     with TheLem do
  255.     begin
  256.       SetTrect(LemRect, round(CenterX - 3), Round(CenterY - 7), round(centerX + 3),
  257.         round(centery + 3));
  258.  
  259.       // main base
  260.       Line(round(points[0].x), round(Points[0].y), round(points[1].x), round(points[1].y));
  261.       Line(round(points[0].x), round(Points[0].y), round(points[2].x), round(points[2].y));
  262.       Line(round(points[1].x), round(points[1].y), Round(points[3].x), Round(Points[3].y));
  263.       Line(Round(points[2].x), round(Points[2].y), round(points[3].x), round(points[3].y));
  264.  
  265.       // top of module (chase around)
  266.       for i := 4 to 10 do
  267.         Line(round(points[i].x), round(points[i].y), round(points[i + 1].x),
  268.           round(Points[i + 1].y));
  269.  
  270.       // legs
  271.       // right side
  272.       line(round(points[12].x), round(points[12].y), round(points[13].x),
  273.         round(points[13].y));
  274.       Line(Round(points[14].x), round(points[14].y), round(points[15].x),
  275.         round(Points[15].y));
  276.  
  277.       // left side
  278.       line(round(Points[16].x), round(points[16].y), round(Points[17].x),
  279.         round(points[17].y));
  280.       Line(Round(points[18].x), round(Points[18].y), round(points[19].x),
  281.         round(Points[19].y));
  282.  
  283.       // thrusters
  284.       if thrust <> 0 then
  285.       begin
  286.         line(round(points[20].x), round(points[20].y), round(points[21].x),
  287.           round(points[21].y));
  288.         line(round(points[22].x), round(points[22].y), round(points[23].x),
  289.           round(points[23].y));
  290.       end;
  291.     end;
  292.   end;
  293.  
  294.  
  295.   procedure Nextactivepage;
  296.   begin
  297.     if page = page0 then page := page1
  298.     else
  299.       page := page0;
  300.     SetactivePage(Ord(Page));
  301.   end;
  302.  
  303.   procedure NextVisualPage;
  304.   begin
  305.     SetVisualpage(Ord(Page));
  306.   end;
  307.  
  308.   procedure updateinfo;
  309.   var
  310.     s: string;
  311.   begin
  312.     setcolor(15);
  313.     with inforect do
  314.     begin
  315.  
  316.       setviewport(x1 + 1, y1 + 1, x2 - 1, y2 - 1, true);  // info viewport
  317.       clearviewport;
  318.  
  319.       str(Fuel: 5: 2, s);
  320.       if fuel < 100 then setcolor(4);
  321.  
  322.       outtextxy(4, 4, 'Fuel:' + s);
  323.       Speed := abs(gravity) * 100;
  324.       str(Speed: 5: 2, s);
  325.       SetColor(15);
  326.       OutTextXY(4, 14, 'Speed:' + s);
  327.       Str(TotalDegrees, s);
  328.       OutTextXY(4, 26, 'Degrees:' + s);
  329.       str(HScore.HPoints: 5: 2, s);
  330.       OutTextXY(4, 38, 'High score:' + s);
  331.     end;
  332.  
  333.     setviewport(0, 0, getmaxx, getmaxy, True);      // full screen
  334.     with inforect do rectangle(x1,y1,x2,y2);
  335.     with mainrect do
  336.     begin
  337.       rectangle(x1, y1, x2, y2);
  338.       setviewport(x1 + 1, y1 + 1, x2 - 1, y2 - 1, True);   // main display
  339.  
  340.     end;
  341.  
  342.     with landingpadrect do
  343.       rectangle(x1, y1, x2, y2);  // draw landing pad
  344.   end;
  345.  
  346.   procedure Init;
  347.   var
  348.     Pts,
  349.     i:integer;
  350.  
  351.   begin
  352.  
  353.     fillchar(degreepoints,sizeof(degreepoints),0);
  354.     Pts := 100;
  355.     for i := 0 to 5 do
  356.     begin
  357.       degreepoints[i] := pts;
  358.       dec(pts,10);
  359.     end;
  360.  
  361.     pts := 100;
  362.  
  363.     for i := 355 to 360 do
  364.     begin
  365.     degreepoints[i] := pts;
  366.     dec(pts,10);
  367.     end;
  368.  
  369.  
  370.     SetFillstyle(solidfill, 7);
  371.     gravitycycle := 0;
  372.     xpos := 300;
  373.     yposition := 30;
  374.     gravity := 0.038;
  375.     Inertia := 0.0015;
  376.     ypos := round(YPosition);
  377.     xposition := xpos;
  378.     thrust := 0;
  379.     thrustcycle := 0;
  380.     SideThrust := 0;
  381.     Fuel := FuelLevels[Level];
  382.     SideThruster := 0;
  383.     OldXposition := Xposition;
  384.     OldYPosition := YPosition;
  385.     TotalDegrees := 0;
  386.     Degrees := 0;
  387.   end;
  388.  
  389.  
  390.  
  391.  
  392. begin
  393.  
  394.   gdriver := vesa;  // adjust initgraph for your system
  395.   Gmode := installusermode(800, 600, 256, 2, 8000, 6000);  // two pages
  396.   WindowTitle := 'RetroLEM';
  397.   initgraph(gdriver, gmode, '');
  398.   hscore.HPoints := 0;
  399.  
  400.   // get high score if file is there
  401.   findfirst(filename, archive, dir);
  402.   if doserror = 0 then
  403.   begin
  404.     Assign(Highscorefile, filename);
  405.     reset(Highscorefile, 1);
  406.     Read(highscorefile, Hscore);
  407.     Close(highscorefile);
  408.   end;
  409.  
  410.   Randomize;
  411.   settRect(MainRect, 0, 0, getmaxx, getmaxy - 60);
  412.   with mainrect do SetTrect(InfoRect, x1 + 250, y2 + 2, x1 + 400, y2 + 50);
  413.   repeat
  414.     cleardevice;
  415.     setcolor(14);
  416.     with mainrect do
  417.     begin
  418.       OutTextXY(x1 + 240, 220, ' Skill level to play?');
  419.       OutTextXY(x1 + 270, 232, '<E>asy');
  420.       OutTextXY(x1 + 270, 244, '<M>edium');
  421.       OutTextXY(x1 + 270, 256, '<H>ard');
  422.     end;
  423.  
  424.     repeat
  425.       key := readkey;
  426.     until key in Levelchars;
  427.  
  428.     case key of
  429.       'e', 'E': level := easy;
  430.       'm', 'M': level := medium;
  431.       'h', 'H': level := hard;
  432.     end;
  433.     cleardevice;
  434.  
  435.     init;
  436.     SetLem;
  437.     DrawLEM;     // draw the lander
  438.     Setcolor(14);
  439.     with mainrect do
  440.     begin
  441.       OutTextXY(x1 + 200, 220, '2 = main thruster');
  442.       OutTextXY(x1 + 200, 230, '1 = rotate right');
  443.       OuttextXY(x1 + 200, 240, '3 = rotate left');
  444.       OutTextXY(x1 + 200, 250, 'Press escape to exit game');
  445.       OutTextXY(x1 + 100, 270, 'To avoid crashing you must land on the pad, your speed must be <=15');
  446.       OuttextXY(x1 + 100, 280, 'and your vertical orientation must be between');
  447.       OutTextXY(x1 + 100, 290, '355 and 5 degrees.');
  448.       OutTextXY(x1 + 100, 310, 'Press any key to begin');
  449.     end;
  450.  
  451.     with Mainrect do
  452.     begin
  453.       rectangle(x1, y1, x2, y2);
  454.       case level of
  455.       Easy: padx := random(500)+125;
  456.       Medium: padx := random(600)+100;
  457.       Hard: padx := random(700)+25;
  458.       end;
  459.       setTrect(LandingPadRect, padx, y2 - 6, padx + LevelWidth[level], y2 - 1);
  460.     end;
  461.  
  462.  
  463.     CenterScoreAdjustment := (abs(400 - Landingpadrect.x1 +
  464.       ((landingpadrect.x2 - landingpadrect.x1) div 2))) * leveladjustment[level];
  465.  
  466.     updateinfo;
  467.     outofbounds := False;
  468.     goodlanding := False;
  469.     readkey;
  470.     repeat
  471.       Speed := abs(gravity) * 100;
  472.       if fuel > 0 then
  473.       begin
  474.       if boolean(GetAsyncKeyState(VK_NUMPAD2)) then
  475.       begin
  476.         if (totaldegrees > 90) and (totaldegrees < 270) then
  477.           thrust := 0.015
  478.         else
  479.           Thrust := -0.015;
  480.  
  481.         thrustcycle := 0;
  482.       end;
  483.  
  484.       if boolean(GetAsyncKeyState(VK_NUMPAD1)) then
  485.       begin
  486.         Thrust := -0.01;
  487.         degrees := 1;
  488.         rotatelem(degrees);
  489.         TotalDegrees := totaldegrees + degrees;
  490.         if totaldegrees > 359 then totaldegrees := 0;
  491.         if (totaldegrees > 90) and (Totaldegrees < 270) then
  492.         begin
  493.  
  494.           SideThrust := -inertia;
  495.         end
  496.         else
  497.           SideThrust := sidethrust + inertia;
  498.  
  499.         thrustcycle := 0;
  500.         Sidethruster := sidethrust;
  501.       end;
  502.  
  503.       if boolean(GetAsyncKeyState(VK_NUMPAD3)) then
  504.       begin
  505.         thrustcycle := 0;
  506.         Thrust := -0.01;
  507.         degrees := -1;
  508.         rotatelem(degrees);
  509.         TotalDegrees := Totaldegrees + degrees;
  510.         if totaldegrees < 0 then totaldegrees := 360;
  511.         if (totaldegrees > 90) and (totaldegrees < 270) then
  512.         begin
  513.  
  514.           sidethrust := -inertia;
  515.         end
  516.         else
  517.           sidethrust := sidethrust - inertia;
  518.  
  519.         sidethruster := sidethrust;
  520.       end;
  521.       end;
  522.       gravitycycle := gravitycycle + 1;      // animation clock
  523.  
  524.       if gravitycycle = gravitycyclemax then
  525.       begin
  526.         OldXposition := Xposition;
  527.         OldYPosition := YPosition;
  528.         ypos := round(YPosition);
  529.         xpos := round(Xposition);
  530.         nextvisualpage;
  531.         clearviewport;  // clear active page
  532.         gravitycycle := 0;
  533.         yposition := yposition + gravity;
  534.         xposition := xposition + sidethrust;
  535.         gravity := gravity + thrust + inertia;
  536.         ypos := round(YPosition);
  537.         xpos := round(Xposition);
  538.         // set new activepage
  539.         nextactivepage;
  540.         DrawLEM;
  541.  
  542.         nextvisualpage;  // show the lander
  543.         if fuel > 0 then
  544.         Fuel := fuel + (thrust - (abs(sidethruster))) * 100;
  545.  
  546.         if fuel <0 then fuel := 0;
  547.  
  548.         updateinfo;
  549.       end;
  550.  
  551.       thrustcycle := thrustcycle + 1;    // thruster duration clock
  552.  
  553.       if ThrustCycle > ThrustCycleMax then
  554.       begin
  555.         updateinfo;
  556.         thrust := 0;
  557.         Thrustcycle := 0;
  558.         SideThruster := 0;
  559.       end;
  560.  
  561.       if not RectInRect(LemRect, Mainrect) then OutofBounds := True;
  562.  
  563.       if ((totaldegrees <= 5) or (totaldegrees >= 355)) and
  564.         (positioninrect(LemRect.x1, LemRect.y2, LandingPadRect) or
  565.         Positioninrect(LemRect.x2, Lemrect.y2, landingpadrect)) and (speed <= 15) then
  566.         GoodLanding := True;
  567.  
  568.       if (positioninrect(LemRect.x1, LemRect.y2, LandingPadRect) or
  569.         Positioninrect(LemRect.x2, Lemrect.y2, landingpadrect)) and (speed > 15) then
  570.         OutofBounds := True;
  571.  
  572.     until (boolean(GetAsyncKeyState(VK_ESCAPE))) or OutOfBounds or Goodlanding;
  573.  
  574.     setviewport(0, 0, getmaxx, getmaxy, True);
  575.     key := ' ';
  576.     cleardevice;
  577.     Points := Points - Gravity * 100;
  578.     if goodlanding then
  579.     begin
  580.       setcolor(14);
  581.       OutTextXY(250, 170, 'Congrats on the fine landing!');
  582.       if fuel>0 then
  583.       begin
  584.         FuelBonus :=  fuel * leveladjustment[level];
  585.         Str(FuelBonus:4: 2, Infostring);
  586.         infostring := AddStrLen(infostring,8);
  587.         OutTextXY(250,192,infostring+' - Fuel bonus:');
  588.       end
  589.       else
  590.       fuelbonus := 0;
  591.  
  592.       DistanceBonus := CenterScoreAdjustment;
  593.       Str(DistanceBonus:4:2,InfoString);
  594.       infostring := AddStrLen(infostring,8);
  595.       OutTextXY(250,204,infostring+' - Distance bonus');
  596.  
  597.       Points := Points * leveladjustment[level];
  598.        if points <0 then
  599.             points := 0;
  600.  
  601.         Str(Points: 4: 2, InfoString);
  602.         infostring := AddStrLen(infostring,8);
  603.         OutTextXY(250,216,infostring+' - Landing points');
  604.  
  605.  
  606.  
  607.       Speed := abs(gravity) * 100;
  608.       str(Speed: 4: 2, InfoString);
  609.       infostring := AddStrLen(infostring,8);
  610.       SetColor(4);
  611.       OutTextXY(250,228,infostring +' - Speed penalty');
  612.  
  613.       Str(degreepoints[TotalDegrees], InfoString);
  614.       setcolor(14);
  615.       infostring := AddStrLen(infostring,5);
  616.       OutTextXY(250,240,infostring+'.00'+ ' - Position points');
  617.  
  618.       Points :=  Points + FuelBonus + DistanceBonus-speed+degreepoints[totaldegrees];
  619.       Str(Points: 4: 2, Infostring);
  620.       infostring := AddStrLen(infostring,8);
  621.       OutTextXY(250,252, infostring + ' - Total Points');
  622.  
  623.       if points > Hscore.Hpoints then
  624.       begin
  625.         Setcolor(4);
  626.         OutTextXY(250, 300, 'NEW HIGH SCORE!');
  627.         hscore.Hpoints := points;
  628.         Assign(highscorefile, filename);
  629.         rewrite(Highscorefile, 1);
  630.         Write(highscorefile, hscore);
  631.         Close(highscorefile);
  632.         setcolor(15);
  633.       end;
  634.     end;
  635.  
  636.     if outofbounds then
  637.     begin
  638.  
  639.         OutTextXY(250, 300, 'You crashed! Try again!');
  640.         Speed := abs(gravity) * 100;
  641.         str(Speed: 5: 2, InfoString);
  642.         SetColor(15);
  643.         OutTextXY(250, 314, 'Speed:' + InfoString);
  644.         Str(TotalDegrees, InfoString);
  645.         OutTextXY(250, 326, 'Degrees:' + InfoString);
  646.  
  647.     end;
  648.  
  649.     OutTextXY(250, 364, 'Play again? y/n ');
  650.     repeat
  651.       if keypressed then Key := readkey;
  652.     until (key = 'y') or (Key = 'n');
  653.   until (key = 'n') or (key = 'N');
  654.   closegraph;
  655.  
  656. end.
  657.  
  658.  
« Last Edit: March 31, 2025, 01:40:06 pm by TBMan »

Lulu

  • Sr. Member
  • ****
  • Posts: 299
Re: A playable game - RetroLEM
« Reply #1 on: April 01, 2025, 09:20:31 pm »
Hi TBMan,
for polygon collision detection (and other shapes) there is a bunch of function explained here:
https://jeffreythompson.org/collision-detection/index.php

They are written in C but they are easy to translate in Pascal.

Regard
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

TBMan

  • Full Member
  • ***
  • Posts: 161
Re: A playable game - RetroLEM
« Reply #2 on: April 01, 2025, 11:25:30 pm »
Hi TBMan,
for polygon collision detection (and other shapes) there is a bunch of function explained here:
https://jeffreythompson.org/collision-detection/index.php

They are written in C but they are easy to translate in Pascal.

Regard

Thanks Lulu. I take a look.

 

TinyPortal © 2005-2018