# \[Announcement\] MakeCode Arcade Mini Game Jam #4 - Outer Space Jam

**URL:** https://forum.makecode.com/t/announcement-makecode-arcade-mini-game-jam-4-outer-space-jam/15689
**Category:** Arcade
**Tags:** mini-game-jam
**Created:** [October 3, 2022, 5:18pm UTC](https://forum.makecode.com/t/announcement-makecode-arcade-mini-game-jam-4-outer-space-jam/15689 "2022-10-03T17:18:16Z")
**Posts on this page:** 1
**Showing post:** 71

<div class="post-metadata">

### Author: ![kwx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kwx/32/1545_2.png) [@kwx](https://forum.makecode.com/u/kwx)
#### Post date: [October 21, 2022, 5:44pm UTC](https://forum.makecode.com/t/announcement-makecode-arcade-mini-game-jam-4-outer-space-jam/15689/71 "2022-10-21T17:44:08Z")

</div>

The spaceship is not a sprite, it’s a 3D model using realtime perspective rendering and shading, lovingly drawn pixel by pixel every frame 🙂

If you’re curious, check out the _ShipModel_ class in `main.ts` which has the 3D coordinates of the corners and the faces connecting them. The actual drawing happens in the renderer code in `triangle.ts`. In short:

- sort the drawn objects (spaceships and asteroids) and handle them in far-to-near order
- for the spaceship model, determine the correct order in which to draw its parts. It’s a BSP tree where planes split it into convex sub-models.
- for each part, use a transform matrix for orientation/position and a perspective transform to get screen coordinates for each corner (vertex)
- use clipping to cut away any parts of faces that extend beyond the screen edges
- convert the face polygons to trapezoids with vertical edges
- add the trapezoids to a list sorted by X (horizontal) starting position
- once all parts have been added, go through the trapezoid list and draw vertical lines for each X position of each trapezoid, in back-to-front order

---

_[View the full topic](https://forum.makecode.com/t/announcement-makecode-arcade-mini-game-jam-4-outer-space-jam/15689)._
