Code of Web Version of FlyingUK

Flying over towns in England and Wales

Introduction

We converted Peter Hearnshaw's FlyingUK to run in Smart Mobile Studio so that you can try it effortlessly (on the preceding web page). Initial set-up instructions are in the ApplicationStarting procedure, mouse and touch input in the procedures assigned to GameView.OnMouseMove and GameView.OnTouchMove, and the bulk of the code (including three nested procedures) in PaintView. We pasted the contents of places.txt into the code and enclosed it in double quotes, taking advantage of Smart's multi-line string facility.

The conversion demonstrates:
  • a double-quoted multi-line string;
  • input from the mouse and keyboard;
  • the display of text with Canvas.FillTextF, lines with Canvas.LineF, rectangles with Canvas.FillBounds and a polygon for the coastline by creating a path then drawing the outline with Canvas.Stroke and filling it with Canvas.Fill;
  • the display of bold text and customised colours.

Smart Pascal Code

unit Unit1;
{
    Copyright (c) 2011 Peter Hearnshaw

    Licensed under the Apache License, Version 2.0 (the "License"); you may not
    use this file except in compliance with the License, as described at
    http://www.apache.org/licenses/ and http://www.pp4s.co.uk/licenses/

    Adapted to run in Smart Mobile Studio by PPS (2015)
}
interface

uses
  System.Types, SmartCL.System, SmartCL.Components, SmartCL.Application,
  SmartCL.Game, SmartCL.GameApp, SmartCL.Graphics, SmartCL.Touch;

type
  TCanvasProject = class(TW3CustomGameApplication)
  private
    degr, x1, x2, y1, y2, movex, movey, distanceAway, Tsize: integer;
    xmiddle, ymiddle: integer;
    getmousex : integer;
    getmousey : integer;
  protected
    procedure ApplicationStarting; override;
    procedure ApplicationClosing; override;
    procedure PaintView(Canvas: TW3Canvas); override;
  end;

implementation

procedure TCanvasProject.ApplicationStarting;
begin
  inherited;
  GameView.OnMouseMove := procedure(o : TObject; ss : TShiftState; x, y : integer)
    begin
      getmousex := x;
      getmousey := y;
    end;
  GameView.OnTouchMove := procedure(Sender: TObject; Info: TW3TouchData)
    begin
      getmousex := Info.Touches.Touches[0].PageX;
      getmousey := Info.Touches.Touches[0].PageY;
    end;

  GameView.Delay := 40;
  movex := 4380;
  movey := 4750;
  xmiddle := GameView.Width div 2;
  ymiddle := GameView.Height div 2;
  GameView.StartSession(False);
end;

procedure TCanvasProject.ApplicationClosing;
begin
  GameView.EndSession;
  inherited;
end;

procedure TCanvasProject.PaintView(Canvas: TW3Canvas);

procedure placePoint(x: integer; y: integer; place: string; Tsize: integer);
  begin
    case Tsize of
      1:
      begin
        Canvas.FillStyle := 'yellow';
        Canvas.SetPixel(-movex + x, -movey + y);
        Canvas.SetPixel(-movex + x, -movey + 1 + y);
        Canvas.SetPixel(-movex + 1 + x, -movey + y);
        Canvas.Font := '12pt verdana';
        Canvas.FillStyle := 'rgb(205, 51, 51)';
      end;
      2:
      begin
        Canvas.FillStyle := 'yellow';
        Canvas.FillBounds(-movex + x, -movey + y, -movex + x + 3, -movey + y + 3);
        Canvas.Font := 'bold 14pt verdana';
        Canvas.FillStyle := 'rgb(227, 38, 54)';
      end;
      3:
      begin
        Canvas.FillStyle := 'yellow';
        Canvas.FillBounds(-movex + x, -movey + y, -movex + x + 8, -movey + y + 8);
        Canvas.Font := 'bold 16pt verdana';
        Canvas.FillStyle := 'rgb(227, 38, 54)';
      end;
    end;
    Canvas.FillTextF(place, -movex + x + 5, -movey + y - 5, MAX_INT);
  end;

  procedure setPointsUp;
  var
    CurrentLine, x, y, Name : string;
    pos10 : integer;
    Places : string := "3862 1092 Blackpool
5985 677 Harrogate
7846 446 Bridlington
6631 754 York
5000 1154 Burnley
a4338 1246 Preston
4738 1646 Bolton
5123 1538 Rochdale
5169 1738 Oldham
5646 1492 Huddersfield
3908 1492 Southport
a7677 1277 Hull
7538 1308 Hessle
8015 1677 Grimsby
7231 1662 Scunthorpe
b4985 1877 Manchester
b3969 2031 Liverpool
a6077 2123 Sheffield
8123 2169 Louth
3815 2108 Birkenhead
4277 2231 Runcorn
4262 1954 St Helens
4077 2554 Chester
6138 2477 Chesterfield
7385 2462 Lincoln
6446 2692 Mansfield
5092 2954 Stoke-on-Trent
2769 2262 Llandudno
3246 2292 Rhyl
2338 2462 Bangor
8092 3062 Boston
a6538 3123 Nottingham
a6077 3185 Derby
a8677 3585 Kings Lynn
4692 3754 Telford
a6538 3846 Leicester
10077 3431 North Walsham
a7800 4000 Peterborough
a9954 3862 Norwich
10554 3923 Great Yarmouth
10600 4215 Lowestoft
b5462 4215 Birmingham
7169 4200 Corby
a6000 4385 Coventry
5646 4354 Solihull
a6862 4769 Northampton
a8292 4862 Cambridge
5015 4877 Worcester
2415 4369 Aberystwyth
a7062 5231 Milton Keynes
9738 5185 Ipswich
4338 5185 Hereford
9400 5569 Colchester
5231 5554 Cheltenham
a7538 5585 Luton
4969 5615 Gloucester
2092 5646 Carmarthen
1169 5769 Haverfordwest
8785 5908 Chelmsford
7677 5877 St Albans
a6385 5862 Oxford
1092 5954 Milford Haven
2615 6185 Swansea
2815 6077 Neath
3554 6662 Barry
3108 6431 Bridgend
3415 5877 Merthyr Tydfil
b3662 6477 Cardiff
3631 6262 Caerphilly
a3923 6246 Newport
b4508 6523 Bristol
5646 6308 Swindon
7092 6154 High Wycombe
8785 6277 Basildon
b9108 6338 Southend-on-Sea
b7938 6470 City of London
7615 6508 Hounslow
8000 6723 Croydon
8169 6646 Bromley
7354 6846 Woking
8877 6954 Maidstone
7862 7308 Crawley
8923 7877 Hastings
8523 8077 Eastbourne
a7938 7969 Brighton
a6600 8015 Portsmouth
a6154 7769 Southampton
a5508 8169 Bournemouth
4692 8415 Weymouth
4446 7677 Yeovil
3969 6800 Weston-super-Mare
3923 7277 Bridgwater
3785 7538 Taunton
3600 8202 Sidmouth
3246 7785 Tiverton
3338 8415 Exmouth
a3185 8169 Exeter
3092 8585 Newton Abbot
3138 8769 Torbay
a2323 8954 Plymouth
2462 7354 Barnstaple
2231 7523 Bideford
1523 8738 Bodmin
1415 9031 St Austell
1015 8862 Newquay
1046 9215 Truro
369 9492 Penzance
7554 6062 Watford
a6769 6554 Reading
5354 8185 Poole
5354 8431 Swanage
7046 5723 Aylesbury
4262 3692 Shrewsbury
7831 6569 Wandsworth
7892 6046 Barnet
7692 6200 Harrow
7892 6338 Camden
7846 5692 Welwyn Garden City
7477 5015 Bedford
9323 3369 Fakenham
9938 7292 Dover
5692 1154 Bradford
3938 2938 Wrexham
3738 3800 Welshpool
2385 3185 Porthmadog
b5169 3954 Wolverhampton
5446 4662 Redditch
9938 3200 Cromer
8862 3154 Hunstanton
 ";

  begin
    //coast
    Canvas.BeginPath;
    Canvas.StrokeStyle := 'rgb(0, 0, 128)';
    Canvas.moveToF(-movex + 3477, -movey + 0);
    Canvas.LineToF(-movex + 3585, -movey + 169);
    Canvas.LineToF(-movex + 3662, -movey + 46);
    Canvas.LineToF(-movex + 3569, -movey + 292);
    Canvas.LineToF(-movex + 3708, -movey + 446);
    Canvas.LineToF(-movex + 3877, -movey + 154);
    Canvas.LineToF(-movex + 3985, -movey + 338);
    Canvas.LineToF(-movex + 4108, -movey + 154);
    Canvas.LineToF(-movex + 4231, -movey + 369);
    Canvas.LineToF(-movex + 4062, -movey + 538);
    Canvas.LineToF(-movex + 4123, -movey + 738);
    Canvas.LineToF(-movex + 3969, -movey + 815);
    Canvas.LineToF(-movex + 3815, -movey + 938);
    Canvas.LineToF(-movex + 3846, -movey + 1138);
    Canvas.LineToF(-movex + 3969, -movey + 1277);
    Canvas.LineToF(-movex + 4062, -movey + 1277);
    Canvas.LineToF(-movex + 3938, -movey + 1431);
    Canvas.LineToF(-movex + 3815, -movey + 1708);
    Canvas.LineToF(-movex + 3846, -movey + 1862);
    Canvas.LineToF(-movex + 3908, -movey + 2077);
    Canvas.LineToF(-movex + 4062, -movey + 2200);
    Canvas.LineToF(-movex + 4262, -movey + 2246);
    Canvas.LineToF(-movex + 4077, -movey + 2338);
    Canvas.LineToF(-movex + 3938, -movey + 2185);
    Canvas.LineToF(-movex + 3831, -movey + 2015);
    Canvas.LineToF(-movex + 3646, -movey + 2077);
    Canvas.LineToF(-movex + 3754, -movey + 2231);
    Canvas.LineToF(-movex + 3846, -movey + 2431);
    Canvas.LineToF(-movex + 3462, -movey + 2185);
    Canvas.LineToF(-movex + 3077, -movey + 2308);
    Canvas.LineToF(-movex + 2708, -movey + 2185);
    Canvas.LineToF(-movex + 2400, -movey + 2462);
    Canvas.LineToF(-movex + 2354, -movey + 2400);
    Canvas.LineToF(-movex + 2431, -movey + 2308);
    Canvas.LineToF(-movex + 2262, -movey + 2231);
    Canvas.LineToF(-movex + 2154, -movey + 2046);
    Canvas.LineToF(-movex + 1938, -movey + 2000);
    Canvas.LineToF(-movex + 1738, -movey + 2062);
    Canvas.LineToF(-movex + 1585, -movey + 2231);
    Canvas.LineToF(-movex + 1646, -movey + 2400);
    Canvas.LineToF(-movex + 1892, -movey + 2615);
    Canvas.LineToF(-movex + 2000, -movey + 2692);
    Canvas.LineToF(-movex + 2154, -movey + 2615);
    Canvas.LineToF(-movex + 2092, -movey + 2708);
    Canvas.LineToF(-movex + 2015, -movey + 2908);
    Canvas.LineToF(-movex + 1738, -movey + 3154);
    Canvas.LineToF(-movex + 1523, -movey + 3338);
    Canvas.LineToF(-movex + 1462, -movey + 3523);
    Canvas.LineToF(-movex + 1708, -movey + 3431);
    Canvas.LineToF(-movex + 1831, -movey + 3462);
    Canvas.LineToF(-movex + 1877, -movey + 3308);
    Canvas.LineToF(-movex + 2031, -movey + 3262);
    Canvas.LineToF(-movex + 2277, -movey + 3185);
    Canvas.LineToF(-movex + 2338, -movey + 3431);
    Canvas.LineToF(-movex + 2462, -movey + 3677);
    Canvas.LineToF(-movex + 2338, -movey + 3892);
    Canvas.LineToF(-movex + 2431, -movey + 4077);
    Canvas.LineToF(-movex + 2400, -movey + 4308);
    Canvas.LineToF(-movex + 2292, -movey + 4662);
    Canvas.LineToF(-movex + 2031, -movey + 4800);
    Canvas.LineToF(-movex + 1785, -movey + 4985);
    Canvas.LineToF(-movex + 1523, -movey + 5015);
    Canvas.LineToF(-movex + 1323, -movey + 5231);
    Canvas.LineToF(-movex + 1169, -movey + 5292);
    Canvas.LineToF(-movex + 1031, -movey + 5215);
    Canvas.LineToF(-movex + 1015, -movey + 5338);
    Canvas.LineToF(-movex + 738, -movey + 5508);
    Canvas.LineToF(-movex + 800, -movey + 5677);
    Canvas.LineToF(-movex + 985, -movey + 5723);
    Canvas.LineToF(-movex + 938, -movey + 5923);
    Canvas.LineToF(-movex + 1031, -movey + 6123);
    Canvas.LineToF(-movex + 1231, -movey + 6185);
    Canvas.LineToF(-movex + 1385, -movey + 6108);
    Canvas.LineToF(-movex + 1523, -movey + 6062);
    Canvas.LineToF(-movex + 1585, -movey + 5923);
    Canvas.LineToF(-movex + 1908, -movey + 5908);
    Canvas.LineToF(-movex + 2031, -movey + 5815);
    Canvas.LineToF(-movex + 2077, -movey + 5938);
    Canvas.LineToF(-movex + 2169, -movey + 6046);
    Canvas.LineToF(-movex + 2369, -movey + 6077);
    Canvas.LineToF(-movex + 2108, -movey + 6200);
    Canvas.LineToF(-movex + 2077, -movey + 6369);
    Canvas.LineToF(-movex + 2308, -movey + 6338);
    Canvas.LineToF(-movex + 2523, -movey + 6400);
    Canvas.LineToF(-movex + 2538, -movey + 6231);
    Canvas.LineToF(-movex + 2708, -movey + 6169);
    Canvas.LineToF(-movex + 2846, -movey + 6338);
    Canvas.LineToF(-movex + 3000, -movey + 6554);
    Canvas.LineToF(-movex + 3415, -movey + 6723);
    Canvas.LineToF(-movex + 3585, -movey + 6662);
    Canvas.LineToF(-movex + 3692, -movey + 6662);
    Canvas.LineToF(-movex + 3738, -movey + 6477);
    Canvas.LineToF(-movex + 3969, -movey + 6323);
    Canvas.LineToF(-movex + 4200, -movey + 6323);
    Canvas.LineToF(-movex + 4354, -movey + 6185);
    Canvas.LineToF(-movex + 4492, -movey + 6046);
    Canvas.LineToF(-movex + 4631, -movey + 5938);
    Canvas.LineToF(-movex + 4523, -movey + 6169);
    Canvas.LineToF(-movex + 4292, -movey + 6415);
    Canvas.LineToF(-movex + 4092, -movey + 6523);
    Canvas.LineToF(-movex + 4000, -movey + 6677);
    Canvas.LineToF(-movex + 3923, -movey + 6800);
    Canvas.LineToF(-movex + 3923, -movey + 7077);
    Canvas.LineToF(-movex + 3585, -movey + 7154);
    Canvas.LineToF(-movex + 3215, -movey + 7062);
    Canvas.LineToF(-movex + 3046, -movey + 7062);
    Canvas.LineToF(-movex + 2846, -movey + 7015);
    Canvas.LineToF(-movex + 2508, -movey + 7077);
    Canvas.LineToF(-movex + 2200, -movey + 7169);
    Canvas.LineToF(-movex + 2215, -movey + 7415);
    Canvas.LineToF(-movex + 2077, -movey + 7554);
    Canvas.LineToF(-movex + 1831, -movey + 7508);
    Canvas.LineToF(-movex + 1708, -movey + 7831);
    Canvas.LineToF(-movex + 1662, -movey + 8077);
    Canvas.LineToF(-movex + 1492, -movey + 8292);
    Canvas.LineToF(-movex + 1400, -movey + 8446);
    Canvas.LineToF(-movex + 1154, -movey + 8554);
    Canvas.LineToF(-movex + 1000, -movey + 8815);
    Canvas.LineToF(-movex + 800, -movey + 9108);
    Canvas.LineToF(-movex + 569, -movey + 9292);
    Canvas.LineToF(-movex + 169, -movey + 9385);
    Canvas.LineToF(-movex + 185, -movey + 9662);
    Canvas.LineToF(-movex + 338, -movey + 9631);
    Canvas.LineToF(-movex + 415, -movey + 9492);
    Canvas.LineToF(-movex + 723, -movey + 9615);
    Canvas.LineToF(-movex + 815, -movey + 9846);
    Canvas.LineToF(-movex + 1031, -movey + 9677);
    Canvas.LineToF(-movex + 1000, -movey + 9477);
    Canvas.LineToF(-movex + 1154, -movey + 9323);
    Canvas.LineToF(-movex + 1415, -movey + 9231);
    Canvas.LineToF(-movex + 1492, -movey + 9031);
    Canvas.LineToF(-movex + 1831, -movey + 9046);
    Canvas.LineToF(-movex + 2092, -movey + 8923);
    Canvas.LineToF(-movex + 2369, -movey + 9015);
    Canvas.LineToF(-movex + 2785, -movey + 9277);
    Canvas.LineToF(-movex + 3015, -movey + 9262);
    Canvas.LineToF(-movex + 3154, -movey + 8985);
    Canvas.LineToF(-movex + 3246, -movey + 8585);
    Canvas.LineToF(-movex + 3308, -movey + 8462);
    Canvas.LineToF(-movex + 3431, -movey + 8415);
    Canvas.LineToF(-movex + 3600, -movey + 8262);
    Canvas.LineToF(-movex + 3892, -movey + 8215);
    Canvas.LineToF(-movex + 4046, -movey + 8154);
    Canvas.LineToF(-movex + 4338, -movey + 8246);
    Canvas.LineToF(-movex + 4677, -movey + 8462);
    Canvas.LineToF(-movex + 4754, -movey + 8385);
    Canvas.LineToF(-movex + 4908, -movey + 8385);
    Canvas.LineToF(-movex + 5231, -movey + 8477);
    Canvas.LineToF(-movex + 5369, -movey + 8446);
    Canvas.LineToF(-movex + 5431, -movey + 8369);
    Canvas.LineToF(-movex + 5354, -movey + 8262);
    Canvas.LineToF(-movex + 5446, -movey + 8215);
    Canvas.LineToF(-movex + 5662, -movey + 8185);
    Canvas.LineToF(-movex + 5815, -movey + 8154);
    Canvas.LineToF(-movex + 5923, -movey + 8200);
    Canvas.LineToF(-movex + 6062, -movey + 8062);
    Canvas.LineToF(-movex + 6262, -movey + 7985);
    Canvas.LineToF(-movex + 6200, -movey + 7862);
    Canvas.LineToF(-movex + 6538, -movey + 8077);
    Canvas.LineToF(-movex + 6862, -movey + 8062);
    Canvas.LineToF(-movex + 7015, -movey + 8169);
    Canvas.LineToF(-movex + 7369, -movey + 7985);
    Canvas.LineToF(-movex + 7723, -movey + 7954);
    Canvas.LineToF(-movex + 8123, -movey + 8031);
    Canvas.LineToF(-movex + 8446, -movey + 8185);
    Canvas.LineToF(-movex + 8569, -movey + 8108);
    Canvas.LineToF(-movex + 8662, -movey + 7985);
    Canvas.LineToF(-movex + 8892, -movey + 7908);
    Canvas.LineToF(-movex + 9138, -movey + 7831);
    Canvas.LineToF(-movex + 9246, -movey + 7708);
    Canvas.LineToF(-movex + 9492, -movey + 7769);
    Canvas.LineToF(-movex + 9462, -movey + 7600);
    Canvas.LineToF(-movex + 9615, -movey + 7431);
    Canvas.LineToF(-movex + 9892, -movey + 7323);
    Canvas.LineToF(-movex + 10092, -movey + 7246);
    Canvas.LineToF(-movex + 10108, -movey + 7046);
    Canvas.LineToF(-movex + 10046, -movey + 6831);
    Canvas.LineToF(-movex + 10108, -movey + 6723);
    Canvas.LineToF(-movex + 9923, -movey + 6708);
    Canvas.LineToF(-movex + 9615, -movey + 6754);
    Canvas.LineToF(-movex + 9431, -movey + 6769);
    Canvas.LineToF(-movex + 9477, -movey + 6708);
    Canvas.LineToF(-movex + 9369, -movey + 6631);
    Canvas.LineToF(-movex + 9185, -movey + 6554);
    Canvas.LineToF(-movex + 9108, -movey + 6646);
    Canvas.LineToF(-movex + 9077, -movey + 6523);
    Canvas.LineToF(-movex + 8815, -movey + 6477);
    Canvas.LineToF(-movex + 8677, -movey + 6569);
    Canvas.LineToF(-movex + 8492, -movey + 6538);
    Canvas.LineToF(-movex + 8338, -movey + 6508);
    Canvas.LineToF(-movex + 8523, -movey + 6492);
    Canvas.LineToF(-movex + 8708, -movey + 6523);
    Canvas.LineToF(-movex + 8769, -movey + 6431);
    Canvas.LineToF(-movex + 9077, -movey + 6385);
    Canvas.LineToF(-movex + 9323, -movey + 6446);
    Canvas.LineToF(-movex + 9385, -movey + 6277);
    Canvas.LineToF(-movex + 9477, -movey + 6108);
    Canvas.LineToF(-movex + 9446, -movey + 5908);
    Canvas.LineToF(-movex + 9138, -movey + 5954);
    Canvas.LineToF(-movex + 9431, -movey + 5815);
    Canvas.LineToF(-movex + 9738, -movey + 5831);
    Canvas.LineToF(-movex + 9923, -movey + 5631);
    Canvas.LineToF(-movex + 9831, -movey + 5569);
    Canvas.LineToF(-movex + 9938, -movey + 5400);
    Canvas.LineToF(-movex + 10246, -movey + 5154);
    Canvas.LineToF(-movex + 10415, -movey + 4969);
    Canvas.LineToF(-movex + 10415, -movey + 4631);
    Canvas.LineToF(-movex + 10554, -movey + 4400);
    Canvas.LineToF(-movex + 10631, -movey + 4200);
    Canvas.LineToF(-movex + 10600, -movey + 3846);
    Canvas.LineToF(-movex + 10462, -movey + 3538);
    Canvas.LineToF(-movex + 10277, -movey + 3400);
    Canvas.LineToF(-movex + 10062, -movey + 3215);
    Canvas.LineToF(-movex + 9800, -movey + 3138);
    Canvas.LineToF(-movex + 9354, -movey + 3062);
    Canvas.LineToF(-movex + 8877, -movey + 3062);
    Canvas.LineToF(-movex + 8800, -movey + 3215);
    Canvas.LineToF(-movex + 8754, -movey + 3323);
    Canvas.LineToF(-movex + 8615, -movey + 3462);
    Canvas.LineToF(-movex + 8400, -movey + 3369);
    Canvas.LineToF(-movex + 8231, -movey + 3231);
    Canvas.LineToF(-movex + 8354, -movey + 2969);
    Canvas.LineToF(-movex + 8615, -movey + 2738);
    Canvas.LineToF(-movex + 8615, -movey + 2523);
    Canvas.LineToF(-movex + 8492, -movey + 2169);
    Canvas.LineToF(-movex + 8292, -movey + 1846);
    Canvas.LineToF(-movex + 8092, -movey + 1662);
    Canvas.LineToF(-movex + 7862, -movey + 1554);
    Canvas.LineToF(-movex + 7723, -movey + 1277);
    Canvas.LineToF(-movex + 7985, -movey + 1523);
    Canvas.LineToF(-movex + 8154, -movey + 1554);
    Canvas.LineToF(-movex + 8354, -movey + 1523);
    Canvas.LineToF(-movex + 8169, -movey + 1292);
    Canvas.LineToF(-movex + 7969, -movey + 1000);
    Canvas.LineToF(-movex + 7831, -movey + 615);
    Canvas.LineToF(-movex + 7908, -movey + 385);
    Canvas.LineToF(-movex + 7785, -movey + 200);
    Canvas.LineToF(-movex + 7585, -movey);
    Canvas.LineToF(-movex + 3477, -movey);
    Canvas.ClosePath;
    Canvas.Stroke;
    Canvas.FillStyle := 'rgb(131, 170, 93)';
    Canvas.Fill;

    //points
    for var i := 1 to 129 do
      begin
        Tsize := 1;
        pos10 := pos(#10, Places);
        if Places[pos10 - 1] = #13 then
          CurrentLine := LeftStr(Places, pos10 - 2) //Windows
        else
          CurrentLine := LeftStr(Places, pos10 - 1); //Linux
        Delete(Places, 1, pos10);
        x := leftstr(CurrentLine, pos(' ', CurrentLine) - 1);
        Delete(CurrentLine, 1, pos(' ', CurrentLine));
        y := leftstr(CurrentLine, pos(' ', CurrentLine) - 1);
        Delete(CurrentLine, 1, pos(' ', CurrentLine));
        Name := CurrentLine;
        if x[1] = 'a' then
          begin
            Delete(x, 1, 1);
            Tsize := 2;
          end;
        if x[1] = 'b' then
          begin
            Delete(x, 1, 1);
            Tsize := 3;
          end;
        placePoint(StrToInt(x), StrToInt(y), Name, Tsize);
      end;
end;

begin
  Canvas.FillStyle := 'rgb(59, 145, 180)';
  Canvas.FillRectF(0, 0, GameView.Width, GameView.Height);
  SetPointsUp;
  if not ((getmousex - XMIDDLE) = 0) then
    degr := 90 + round((arctan((getmousey - ymiddle) / (getmousex - xmiddle))) / 3.141 * 180);
  if (xmiddle - getmousex > 0) then
    degr := degr + 180;
  x1 := xmiddle + round(12 * sin(-(degr + 180) / 180 * 3.141));
  y1 := ymiddle + round(12 * cos(-(degr + 180) / 180 * 3.141));
  x2 := xmiddle + round(12 * sin(-(degr) / 180 * 3.141));
  y2 := ymiddle + round(12 * cos(-(degr) / 180 * 3.141));
  Canvas.StrokeStyle := 'white';
  Canvas.LineWidth := 3;
  Canvas.BeginPath;
  Canvas.LineF(x1, y1, x2, y2); //Line to represent plane
  Canvas.ClosePath;
  Canvas.Stroke;
  Canvas.LineWidth := 1;
  distanceAway := round(0.15 * sqrt((getmousey - ymiddle) * (getmousey - ymiddle) +
                       (getmousex - xmiddle) * (getmousex - xmiddle)));
  if (distanceAway > 1) then
    begin
      movex := movex + round(distanceAway * sin(-(degr + 180) / 180 * 3.141));
      movey := movey + round(distanceAway * cos(-(degr + 180) / 180 * 3.141));
    end;

  if movey < -220 then
    movey := -220;
  if movey > 10000 then
    movey := 10000;
  if movex < -840 then
    movex := -840;
  if movex > 11000 then
    movex := 0;
end;

end.    
Programming - a skill for life!

Navigation game