Workshop › Scorched Earth-style Artillery › Step 22 of 23
Point below your barrel and the barrel points into the ground: atan2 happily gives angles between 0 and π there (down
is positive on a canvas). The barrel must stay in the upper half, so below it we aim flat to that side instead.
```js
// Below the barrel, atan2 gives an angle between 0 and π: aim flat to that side instead.
t.angle = angle > 0 ? (angle > Math.PI / 2 ? -Math.PI : 0) : angle
```Above the atan2 line, write the comment; replace t.angle = angle with the checked version.
Skills: Velocity and gravity
← Drag and let go Build it yourself: a trail →