[Question]
  [
**EDIT**
It appears that there has been some confusion following my typo in the original post which used a lowercase o to define the plane and then an uppercase later. Unfortunately this bug did not get picked up in the Sandbox. Since many members have written answers with both and since the typo was my fault I will allow either uppercase or lowercase o in the definition of the plane. I have added a new rule for this.
**Background**
I like [ascii art animations](https://codegolf.stackexchange.com/questions/96541/make-an-ascii-bat-fly-around-an-ascii-moon%22ascii%20art%20animations%22) as I tend to call them so here is another one. I don't think this is too difficult to implement so will hopefully get some short and interesting answers.
**To all fellow community members**
If you improve on your answer please modify your byte count as 
**~~old byte count~~ new byte count**
so we can see your progress. Thanks!
**Challenge**
Here is an ascii plane
```
--O--
```
Here is an ascii runway
```
____|     |____
```
The plane starts at 5 newlines above the runway. To prevent any clashes between metric and imperial systems and make this a truly international challenge I won't mention meters or feet. Example:
```
        --O--
____|     |____
```
The Plane must land exactly in the middle of the runway as shown below:
```
____|--O--|____
```
**Input**
The initial horizontal position of the plane is defined by an integer input which is used to reference the tip of the left wing i.e. it is between 0 and 10 inclusive.
**Output**
Each stage of the planes flight must be shown. Example below (input=10):
```
          --O--
____|     |____
         --O--
____|     |____
        --O--
____|     |____
       --O--
____|     |____
      --O--
____|     |____
____|--O--|____
```
To keep things simple, we are ignoring the laws of perspective. The runway stays the same size as you get closer.
**Rules**
* **Update** The middle of the plane can be either an uppercase or lowercase o but whichever is chosen must be consistent throughout the code. If your language does not support the characters above feel free to use alternative ascii only characters.
* The plane descends 1 line per frame.
* The plane can only move 1 space to the left or right each time it descends one line. It does not have to move on each line of descent. As long as it finishes on the runway it is up to you when it moves right or left. You're the pilot!
* No error handling required. You may assume that the input will always be a valid integer from 0-10 inclusive.
* Output must consist of only the characters shown above (if your language does not support them the see edited first rule) and must be the same size i.e. must start 6 lines high by 15 characters wide. The height can decrease as it progresses as in the example above.
* Program or function is fine but must produce an output as shown
above.
* Leading/trailing spaces/newlines are fine by me.
* Please feel free to clear the screen between output frames if you wish. This is **not** a requirement.
* Standard loopholes prohibited as usual (although I don't think there are many that would help with this kind of challenge).
* This is code golf so shortest answer is obviously the winner and will probably get most votes but may not necessarily be accepted as the best answer if some really interesting solution comes along in some unexpected language, even if it is longer. Feel free to post anything that meets the rules as long as it works.
Ungolfed reference implementation in Python 2 available at [Try it online!](https://tio.run/nexus/python2#dVBLDoIwEN33FLMr0NRAohvjcAUPoIQQRamSQqDEmHB3bKdK0MRZvc77zEunti50mfem6Awq3Q4mCBntkEu5l5Kza9cM@owHntsZwc3oIM/YRWnVV@gZknuG9fenNcD3WMPJRhmMHZ97vGaPStUlzJsUY9gypzdN60J4tOgoCGfEt53SBvhR89WtUTqwehHYnGjOCoUvH4IgHdnUBRaBkMLmfY8yF4xESIgo6x/P7q9HfDx0X6B/zIV8pi/uP2@akvgF "Python 2 – TIO Nexus") so you can see how it looks for different input values.
  
[Answer]
# TI-BASIC, 62 bytes
```
:Input A
:A
:For(N,3,8
:ClrHome
:Output(8,1,"----I     I----
:Output(N,Ans,"--O--
:Ans+(Ans<6)-(Ans>6
:End
```
Note that TI-BASIC does not support \_ or | and therefore I replaced with a capital I and -. This should not effect byte count.
[Answer]
## Python 2, 107 bytes
```
n=input();h=5
while h:print' '*n+'--O--'+'\n'*h+'____|     |____\n';n-=cmp(n,5);h-=1
print'____|--O--|____'
```
[Try it online](https://tio.run/nexus/python2#@59nm5lXUFqioWmdYWvKVZ6RmZOqkGFVUJSZV6KuoK6Vp62uq@uvq6uurR6Tp66Voa0eDwQ1CiBQA2ICRa3zdG2Tcws08nRMgabo2hpyQbSDVYJ1g1Wq//9vaAAA)
Simply hardcodes the last line for the landing plane. It can likely be golfed by re-using parts from before or being integrated into the loop.
[Answer]
## Perl, 94 bytes
93 bytes of code + `-p` flag.
```
$\="____|     |____
";$p="--O--";for$i(-5..-1){print$"x$_.$p.$/x-$i;$_+=5<=>$_}$\=~s/ +/$p/}{
```
[Try it online!](https://tio.run/nexus/perl#U1YsSC3KUdAt@K8SY6sUDwQ1CiBQA2JyKVmrFNgq6er66@oqWaflF6lkauia6unpGmpWFxRl5pWoKFWoxOupFOip6FfoqmRaq8Rr25ra2NqpxNcCjasr1lfQ1lcp0K@t/v/fEAA "Perl – TIO Nexus")
[Answer]
# TI-BASIC, 61 bytes
```
Input A
A
For(B,1,5
ClrHome
Output(5,1,"----/     /----
Output(B,Ans,"--O--
Ans+6-median({5,7,Ans
End
```
[Answer]
# JavaScript (ES6), 108 bytes
```
f=(a,b=5)=>b?" ".repeat(a)+`--O--${`
`.repeat(b)}____|     |____
`+f(a<5?a+1:a-1,b-1):"____|--O--|____"
```
## Test it
```
f=
(a,b=5)=>b?" ".repeat(a)+`--O--${`
`.repeat(b)}____|     |____
`+f(a<5?a+1:a-1,b-1):"____|--O--|____"
```
```
<input type=number min=0 max=10 oninput=o.textContent=f(+this.value)><pre id=o>
```
## Usage
Just call `f` with the index of the plane. 
```
f(2)
```
## Output
```
  --O--
____|     |____
   --O--
____|     |____
    --O--
____|     |____
     --O--
____|     |____
    --O--
____|     |____
____|--O--|____
```
[Answer]
## Scala, ~~224~~ 181 bytes
**EDIT**: I had no idea you could do `"string"*n` to repeat it n times! Scala continues to blow my mind. Missing the `if(t>0)` instead of `if(t==0)` was a rookie mistake. Thanks for the tips, [Suma](https://codegolf.stackexchange.com/users/64633/suma)!
---
```
def?(x:Int,t:Int=5):Unit={var(p,o)=("--o--","")
o=s"____|${if(t>0)" "*5 else p}|____\n"
for(i<-0 to t)o=if(i!=0&&i==t)" "*x+p+o else "\n"+o
println(o)
if(t>0)?(x-(x-4).signum,t-1)}
```
---
Original remarks:
I figured a recursive solution would be fun to try. I'm relatively new to Scala, so I'm certain this is far from optimal.
[Answer]
## Batch, 230 bytes
```
@echo off
set/ax=10-%1
set s=          --O--
for /l %%i in (0,1,4)do call:l %%i
echo ____^|--O--^|____
exit/b
:l
call echo %%s:~%x%%%
for /l %%j in (%1,1,3)do echo(
echo ____^|     ^|____
echo(
set/a"x-=x-5>>3,x+=5-x>>3
```
`x` is the number of spaces to remove from the beginning of the string `s`, so I subtract the parameter from 10. The last line is the nearest Batch has to `x-=sgn(x-5)`.
[Answer]
# sed, 181 bytes + 2 for `-nr` flags
```
s/10/X/
:A
s/^/ /;y/0123456789X/-0123456789/;/[0-9]/bA;s/ -/P\n\n\n\n\n____|P|____/
:B
h;s/P([\n|])/--O--\1/;s/P/     /;s/^ *_/_/;p;/^_/q;x;s/\n//
/^ {5}$/bB;/ {6}/s/  //;s/^/ /;bB
```
## Ungolfed
```
# Add leading spaces
s/10/X/
:A
    s/^/ /
    y/0123456789X/-0123456789/
/[0-9]/bA
s/ -/P\n\n\n\n\n____|P|____/
:B
    # Place plane in appropriate spot
    h
    s/P([\n|])/--O--\1/
    s/P/     /
    s/^ *_/_/
    p
    /^_/q
    x
    # Movement
    s/\n//
    /^ {5}$/bB
    # move left one extra, since we'll move right next line
    / {6}/s/  // 
    s/^/ /
bB
```
Usage: `$ echo 2 | sed -nrf flightsim.sed`
[Answer]
# [Retina](https://github.com/m-ender/retina), 86 83 bytes
```
.+
$* --O--¶¶¶¶¶¶____|     |____
{*`$
¶
2D`¶
 ( {5})
$1
}`^ {0,4}-
 $&
 +
--O--
G`_
```
[Try it online!](https://tio.run/nexus/retina#@6@nzaWipaCr66@re2gbAsYDQY0CCNSAmFzVWgkqXIe2cRm5JABJBQ2FatNaTS4VQ67ahDiFagMdk1pdLgUVNS4FbS6wWVzuCfH//xsAAA "Retina – TIO Nexus")
There is probably some sort of compression I could have used on the runway and the empty space over it, but anything I tried came up more expensive than plaintext (in Retina ¶ is a newline, so you can see the initial state in plaintext on the second line).
[Answer]
## [Scala](http://www.scala-lang.org/), 177, 163, 159 137 bytes
```
def p(x:Int,t:Int=5,a:String="\n"):String=a+(if(t>0)
" "*x+"--O--"+"\n"*t+"____|     |____\n"+p(x-(x-4).signum,t-1)else"____|--O--|____")
```
Based on [another answer](https://codegolf.stackexchange.com/a/107290/64633), with significant reductions.
[Answer]
# [Perl 6](http://perl6.org/), ~~97~~ ~~90~~ 81 bytes
```
{say "{"{" "x 15}\n"x 5}____|     |____"~|("\0"x$^h+$_*(17-$h/5)~"--O--") for ^6}
```
Contrary to what it looks like, it outputs the \*lower-case version of the plane (`--o--`), as allowed by the updated task description.
[Try it online!](https://tio.run/nexus/perl6#y61UUEtTsP1fXZxYqaBUDYQKShUKhqa1MXlA2rQ2HghqFECgBsRUqqvRUIoxUKpQicvQVonX0jA011XJ0DfVrFPS1fXX1VXSVEjLL1KIM6v9n6ZgYf0fAA "Perl 6 – TIO Nexus")
### How it works
Bitwise string operators FTW!
```
{                                                  # Lambda accepting horizontal index $h.
    say                                            # Print the following:
        "{ "{ " " x 15 }\n" x 5 }____|     |____"  # The 15x6 background string,
        ~|                                         # bitwise-OR'd against:
        (
            "\0"                                   # The NULL-byte,
            x $^h + $_*(17 - $h/5)                 # repeated by the plane's offset,
            ~ "--O--"                              # followed by an OR mask for the plane.
        )
    for ^6                                         # Do this for all $_ from 0 to 5.
}
```
It works because bitwise string operators use the codepoint values of the characters at a given position in two strings, to calculate a new character at that position in the output string.  
In this case:
```
space  OR  O   =  o
space  OR  -   =  -
any    OR  \0  =  any
```
For an uppercase-`O` plane, we could have used `~^` (string bitwise XOR), with a plane mask of `\r\ro\r\r` (+4 bytes for backslashes):
```
space  XOR   o  =  O
space  XOR  \r  =  -
any    XOR  \0  =  any
```
The formula for the plane's offset, `h + v*(17 - h/5)`, was simplified from:
```
  v*16         # rows to the vertical current position
+ h            # columns to the horizontal starting position
+ (5 - h)*v/5  # linearly interpolated delta between horizontal start and goal
```
[Answer]
# [Python 2](https://docs.python.org/2/), 160 bytes
```
i,s,p,l,r,c,x=input(),' ','--O--','____|','|____',0,4
while x>=0:print'\n'.join([s*i+p]+[s*15]*x+[l+s*5+r])+'\n';c+=1;x-=1;i=((i,i-1)[i>5],i+1)[i<5]
print l+p+r
```
[Try it online!](https://tio.run/nexus/python2#HYxBDsIgFET3PQU7aP/HlCgbK72CB0DiojHxG4IEamTRuyN1FvPeYjKVMGNEjwkXLIZC/KyiR844cimvUjbeW7bGbReOI56675P8g5XZjOeYKKz8Fvjh9aYgbB4IooNGpd1QwHrIg4bkethX0wJGTUW2IiMEIUnVW5q1Q4LdLtp1/0/mIUKq9fgD "Python 2 – TIO Nexus")
Here is the reference implementation golfed down to 160 from 384. Still a way to go I think. Just posted for fun and to encourage a better Python answer.
[Answer]
# Befunge-93, ~~136~~ 130 bytes
```
&5>00p10p55+v
:::00g>:1-\v>:"____|     |_"
>:1-\v^\+55_$"--O--"10g
^\*84_$>:#,_10g::5v>:#,_@
<_v#!:-1g00+`\5\-`<^"____|--O--|____"
```
[Try it online!](http://befunge.tryitonline.net/#code=JjU+MDBwMTBwNTUrdgo6OjowMGc+OjEtXHY+OiJfX19ffCAgICAgfF8iCj46MS1cdl5cKzU1XyQiLS1PLS0iMTBnCl5cKjg0XyQ+OiMsXzEwZzo6NXY+OiMsX0AKPF92IyE6LTFnMDArYFw1XC1gPF4iX19fX3wtLU8tLXxfX19fIg&input=MTA)
**Explanation**
```
&                          Read the plane position.
 5                         Initialise the plane height.
  >                        Begin the main loop.
   00p                     Save the current height.
      10p                  Save the current position.
         55+:              Push two linefeed characters.
         "____|     |_"    Push most of the characters for the airport string.
:::                        Duplicate the last character three times to finish it off.
   00g>:1-\v               Retrieve the current height, and then push
      ^\+55_$                that many copies of the linefeed character.
             "--O--"       Push the characters for the plane.
>:1-\v              10g    Retrieve the current position, and then push
^\*84_$                      that many copies of the space character.
       >:#,_               Output everything on the stack in reverse.
            10g::          Retrieve the current position and make two copies to work with.
                 5v        If it's greater than 5
                -`<          then subtract 1.
           +`\5\           If it's less than 5 then add 1.
        g00                Retrieve the current height.
      -1                   Subtract 1.
 _v#!:                     If it's not zero, repeat the main loop.
^"____|--O--|____"         Otherwise push the characters for the landed plane.
>:#,_@                     Output the string and exit.
```
[Answer]
# Ruby, 94 bytes
```
->a{5.times{|i|puts" "*a+"--O--#{?\n*(5-i)}____|     |____
";a+=5<=>a};puts"____|--O--|____"}
```
Prints the plane's position followed by newlines and then the airport.
Then it moves the plane by 1, -1, or 0, depending on its position relative to 5.
After looping the above 5 times, it prints the plane in the airport.
[Answer]
# [8th](http://8th-dev.com/), ~~177~~ 172 bytes
```
: f 5 >r 5 repeat over " " swap s:* . "--O--" . ' cr r> times "____|     |____\n\n" . over 5 n:cmp rot swap n:- swap n:1- dup >r while "____|--O--|____\n" . 2drop r> drop ; 
```
The word `f` expects an integer between 0 and 10.
**Usage**
```
4 f
```
**Explanation**
```
: f \ n --
  5 >r     \ Push vertical distance from airport to r-stack
  5 repeat 
    \ Print plane
    over " " swap s:* . "--O--" . 
    \ Print airport 
    ' cr r> times "____|     |____\n\n" . 
    \ Now on the stack we have:
    \ distanceFromLeftSide distanceFromAirport
    over      \ Put distance from left side on TOS 
    5 n:cmp   \ Compare left distance and 5. Return
              \ -1 if a<b, 0 if a=b and 1 if a>b
    rot       \ Put distance from left side on TOS   
    swap n:-  \ Compute new distance from left side 
    swap n:1- \ Decrement distance from airport
    dup >r    \ Push new airport-distance on the r-stack  
  while 
  "____|--O--|____\n" .  \ Print final step
  2drop r> drop          \ Empty s-stack and r-stack
;
```
[Answer]
# Mathematica, 111 bytes
```
If[#<1,"____|--O--|____"," "~Table~#2<>"--O--"<>"
"~Table~#<>"____|     |____
"<>#0[#-1,#2+#2~Order~5]]&[5,#]&
```
Anonymous function. Takes a number as input and returns a string as output. Could probably be golfed further.
[Answer]
## [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), ~~93~~ ~~91~~ 84 bytes
```
:{X=space$(a)+@--O--`┘a=a-sgn(a-5)~t>-1|?X[t|?]t=t-1?@____|`+@     `+_fB|\_xB+A+_fB
```
*Dropped some bytes by replacing the declaration of X$; optimised the FOR loop that prints the distance above-ground. Explanation below is for the old version, but it basically works the same.*
For testing (and aesthetics) I had a slightly different version, at 103 bytes:
```
:{_z.5|_CX=Y[a|X=X+@ `]X=X+@--O--`
a=a-sgn(a-5)
~u>0|?X';`[u|?]u=u-1?@____|`+@     `+_fC|\_xC+_tB+_fC
```
These are functionally identical. The second one has the addition that the screen gets cleared between frames and that it halts for 0.5 seconds between frames.
# Sample output
Note that I've added two newlines between frames. The most golfed code above does not add empty lines between frames, the cooler one clears the screen.
```
Command line: 10
          --O--
____|     |____
         --O--
____|     |____
        --O--
____|     |____
       --O--
____|     |____
      --O--
____|     |____
____|--O--|____
```
# Explanation
Since I feel this touches upon many things I really like about QBIC, and gives a good insight in how some of its functions work under the hood, I've gone a bit overboard on the explanation. Note that QBIC is, at its core, an QBasic interpreter for Codegolf. QBIC code goes in - QBasic code comes out (and is subsequently executed).
```
:{      get the starting offset (called 'a') from the command line, and start a DO-loop
----  cool code only  ----
_z.5|_C At the start of a DO-loop, pause for half a second and clear the screen
---- resume golf-mode ----
---- #1 - The tip of the left wing is anywhere between 0 and 10 positions to the right.
----       Create the plane with the spacing in X$
X=Y          Clear X$
[a|          For each point in the current offset
X=X+@ `]     Add a space to X$
    - Every capital letter in QBIC references that letter+$, a variable of type String
    - @ and ` start and end a string literal, in this case a literal space.
    - ] ends one language construct (an IF, DO or FOR). Here, it's NEXT
X=X+@--O--`  Create the actual plane
    - @ and `once again create a string literal. Every literal that is created in this
      way is assigned its own capital letter. This is our second literal, so the body of
      our plane is stored in B$ (A$ contains the space, remember?)
---- #2 Adjust the offset for the next iteration      
a=a-sgn(a-5) The clever bit: We have an offset X in the range 0 - 10, and 5 attempts to 
             get this to be == 5. X - 5 is either positive (X = 6 - 10), negative 
             (X = 0 - 4) or 0 (X=5). sgn() returns the sign of that subtraction 
             as a 1, -1 or 0 resp. We then sub the sign from 'a', moving it closer to 5.
---- #3 Draw the plane, the empty airspace and the landing strip             
~u>0|     Are we there yet?
    - ~ is the IF statement in QBIC
    - It processes everything until the | as one true/false expression
    - All the lower-case letters are (or better, could be) references to numeric 
      variables. Since QBasic does not need to post-fix those, they double as 'natural' 
      language: ignored by QBIC and  passed as literal code to the QBasic beneath.
    - The lower-case letters q-z are kinda special: at the start of QBIC, these 
      are set to 1 - 10. We haven't modified 'u' yet, so in the first DO-loop, u=5
?X';`     If we're still air-borne, print X$ (our plane, incl. spacers)
    - ? denotes PRINT, as it does in QBasic.
    - ' is a code literal in QBIC: everything until the ` is not parsed, but 
      passed on to QBasic.
    - In this case, we want a literal ; to appear after PRINT X$. This suppresses 
      QBasic's normal line-break after PRINT. This needs to be a code literal 
      because it is the command to read a String var from the command Line in QBIC.
[u|?]     FOR EACH meter above the ground, print a newline
u=u-1     Descent 1 meter
?@____|`  Print the LHS of the landing strip
+@     `  plus 5 spaces
+_fC|     plus the LHS reversed.
\         ELSE - touchdown!
_x        Terminate the program (effectively escape the infinite DO-loop)
    - the _x command has an interesting property: ULX, or Upper/Lowercase Extensibility. 
      Writing this command with an uppercase _X does something similar, yet different. 
      The _x command terminates, and prints everything found between _x and | before 
      quitting. Uppercase _X does not look for |, but only prints something if it is 
      followed by a character in the ranges a-z and A-Z - it prints the contents of 
      that variable.
C+B+_fC   But before we quit, print C$ (the LHS of the landing strip) and the plane, 
          and the LHS flipped.
---- #4 QBIC has left the building
- Did I say _x looks for a | ? Well, that gets added implicitly by QBIC at the end of 
  the program, or when one ( ']' ) or all ( '}' ) opened language constructs are closed.
- Also, all still opened language constructs are automatically closed at EOF.
- Had we stored anything in Z$, that would also be printed at this time.
```
[Answer]
# SmileBASIC, ~~109~~ 105 bytes
```
G$="_"*4INPUT X
FOR I=0TO 4?" "*X;"--O--";CHR$(10)*(4-I)?G$;"|     |";G$X=X-SGN(X-5)?NEXT?G$;"|--O--|";G$
```
[Answer]
# PHP 7, 139 bytes
still awfully long
```
for($x=$argv[1],$d=6;$d--;$x+=5<=>$x)for($i=$p=-1;$i++<$d;print"$s
")for($s=$i<$d?" ":"____|     |____
";!$i&++$p<5;)$s[$x+$p]="--O--"[$p];
```
takes input from command line argument; run with `-r`.
**breakdown**
```
for($x=$argv[1],                        // take input
    $y=6;$y--;                          // loop height from 5 to 0
    $x+=5<=>$x)                             // post increment/decrement horizontal position
    for($i=$p=-1;$i++<$y;                   // loop $i from 0 to height
        print"$s\n")                            // 3. print
        for($s=$i<$y?" ":"____|     |____\n";   // 1. template=empty or runway+newline
            !$i&++$p<5;)$s[$x+$p]="--O--"[$p];  // 2. if $i=0, paint plane
```
]