# Scoring: CheckFlyingSkills (Part 1 of 2)

```       Name: CheckFlyingSkills (Part 1 of 2)                         [Show more]
Type: Subroutine
Category: Scoring
Summary: Check whether we are performing one of the tests of flying skill
Deep dive: Flying skills
Context: See this subroutine in context in the source code
References: This subroutine is called as follows:
* MainLoop (Part 5 of 15) calls CheckFlyingSkills

This routine checks where we are, and awards the following points:

* 50 points for flying under the bridge the right way up

* 100 points for flying under the bridge upside down

* 100 points for flying down the main street of Acornsville the right way up

* 200 points for flying down the main street of Acornsville upside down

There are multiple skill zones defined for each object (the bridge and the
main street). To earn the points, we need to fly into the correct skill zones
while avoiding others, and then back out again without hitting the ground.

Arguments:

Y                    The skill to check:

* 2 = Flying under the suspension bridge

* 34 = Flying down the main street of Acornsville

.CheckFlyingSkills

LDA xPlaneHi           \ Set A = xPlaneHi - the x-coordinate of either the
SEC                    \ bridge or town, which is the high byte of the distance
SBC xObjectHi,Y        \ along the x-axis between the plane and the object that
\ we are checking

BPL skil1              \ If A is negative, flip the bits, so A contains the
EOR #&FF               \ absolute value of the distance along the x-axis

.skil1

CMP #5                 \ If the high byte of the distance is less than 5, then
BCC skil3              \ we are close enough to the bridge or town to warrant

.skil2

RTS                    \ Otherwise we are too far away from the bridge and town
\ to score any points, so return from the subroutine

.skil3

LDA zPlaneHi           \ Set A = zPlaneHi - the z-coordinate of either the
SEC                    \ bridge or town, which is the high byte of the distance
SBC zObjectHi,Y        \ along the z-axis between the plane and the object that
\ we are checking

JMP skil4              \ Jump down to part 2 of the routine

EQUB &4D, &50          \ These bytes appear to be unused
```