# Space Rocks 3D!

**URL:** https://forum.makecode.com/t/space-rocks-3d/6334
**Category:** Show & Tell
**Tags:** game, featured-game
**Created:** [February 24, 2021, 3:59pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334 "2021-02-24T15:59:47Z")
**Posts on this page:** 1
**Showing post:** 47

<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: [March 1, 2021, 3:45am UTC](https://forum.makecode.com/t/space-rocks-3d/6334/47 "2021-03-01T03:45:55Z")

</div>

> **[Space Rocks 3D (v7)](https://arcade.makecode.com/53937-93676-14776-54808)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Gameplay changes:

- Press the B button for a speed boost. Use with care.
- The playing area now wraps around, asteroids no longer bounce off invisible walls.
- When starting a new wave, make sure the asteroids aren’t too close to the player.
- Added a new accelerometer control scheme using tilt yaw/pitch and stick roll.

The game now starts at a settings screen that allows choosing the control scheme, cockpit on/off, and some graphics-related flags. You can also choose a starting wave for increased difficulty. The settings are stored persistently using the settings API, so they should remain set across restarts.

Behind the scenes, I restructured how it draws to the screen, cutting the memory consumption almost in half (from ~40kB to~ 25kB according to heap snapshots), and increasing performance a bit. Boring technical bits following, feel free to skip these 🙂

I had been modifying `scene.backgroundImage()` since I thought that this corresponded to the screen buffer, but that’s actually a separate in-memory image which needs about 10kB, and also needs to be copied to the screen every frame as an additional internal step.

Now I’m using `scene.createRenderable()` instead, this is far more efficient since it actually does draw to the screen buffer directly. It’s also integrated into the scene Z hierarchy, making it easy to structure UI layers without needing separate images. See the [Is it possible to write directly to screen (pixels) on the Arcade?](https://forum.makecode.com/t/is-it-possible-to-write-directly-to-screen-pixels-on-the-arcade/510) thread for more information on this.

This also made it possible to simplify the starfield background code a lot, and to add screen shake effects to the radar screen for consistency.

Enjoy!

---

_[View the full topic](https://forum.makecode.com/t/space-rocks-3d/6334)._
