# MakeCode Kart

**URL:** https://forum.makecode.com/t/makecode-kart/5787
**Category:** Collaboration
**Tags:** art
**Created:** [January 27, 2021, 4:09pm UTC](https://forum.makecode.com/t/makecode-kart/5787 "2021-01-27T16:09:21Z")
**Posts on this page:** 1
**Showing post:** 89

<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: [August 26, 2021, 8:55pm UTC](https://forum.makecode.com/t/makecode-kart/5787/89 "2021-08-26T20:55:01Z")

</div>

As far as I know, the fastest way to draw is to use `scene.createRenderable` combined with `Image.setRows`. That’s what I use in Space Rocks 3D.

Here’s an older discussion about the topic: [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)

`scene.createRenderable` takes a function as its second argument, that function gets called each time the screen content is refreshed on updates. The called function gets an `Image` as its first argument which is a reference to the screen buffer, you can modify that image to draw directly onto the screen.

The `image.getRows` and `image.setRows` methods copy pixels from the screen into a byte buffer and back.

Something like this (untested):

```auto
const buf = Buffer.create(120)
const zLayer = 0
scene.createRenderable(zLayer, (target: Image, camera: scene.Camera) => {
  for (let x = 0; x < 160; +=x) {
    // Read the current screen content for modification
    image.getRows(x, buf)
    // Now "buf" contains a color value for the current pixel row 
    // (it's actually a vertical column onscreen) where it can be modified.
    buf[12] = 15
    // Write the modified pixels back to the screen.
    image.setRows(x, buf)
  }
})

```

---

_[View the full topic](https://forum.makecode.com/t/makecode-kart/5787)._
