Changeset 26


Ignore:
Timestamp:
Apr 12, 2015, 12:36:04 AM (10 years ago)
Author:
chronos
Message:
  • Added: Limit per line length of visible waiting passengers at map station.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UEngine.pas

    r25 r26  
    273273  NewPassengerPeriod = 0.3 * OneSecond;
    274274  NewPassengerProbability = 0.002;
     275  VisiblePassengersPerLine = 6;
    275276
    276277implementation
     
    16421643  Angle: Double;
    16431644  EndPoint: TPoint;
     1645  PassengerPos: TPoint;
     1646  Direction: Integer;
    16441647const
    16451648  GameOverText = 'Game Over';
     
    17401743    Canvas.Pen.Style := psClear;
    17411744    Canvas.Brush.Color := clBlack;
     1745    PassengerPos := Point(0, 0);
     1746    Direction := 1;
    17421747    for P := 0 to Passengers.Count - 1 do
    17431748    with TMetroPassenger(Passengers[P]) do begin
    1744       DrawShape(Canvas, Point(Position.X + StationSize + P * (PassengerSize + 2), Position.Y - StationSize div 2),
     1749      DrawShape(Canvas, Point(Position.X + StationSize + PassengerPos.X,
     1750        Position.Y - StationSize div 2 + PassengerPos.Y),
    17451751        Shape, PassengerSize, 0);
     1752      PassengerPos := Point(PassengerPos.X + Direction * (PassengerSize + 2), PassengerPos.Y);
     1753      if PassengerPos.X >= (PassengerSize + 2) * VisiblePassengersPerLine then begin
     1754        Direction := -Direction;
     1755        PassengerPos.X := PassengerPos.X - (PassengerSize + 2);
     1756        PassengerPos.Y := PassengerPos.Y + (PassengerSize + 2);
     1757      end;
     1758      if PassengerPos.X < 0 then begin
     1759        Direction := -Direction;
     1760        PassengerPos.X := 0;
     1761        PassengerPos.Y := PassengerPos.Y + (PassengerSize + 2);
     1762      end;
    17461763    end;
    17471764
Note: See TracChangeset for help on using the changeset viewer.