# Drawing straight to the screen?

**URL:** https://forum.makecode.com/t/drawing-straight-to-the-screen/18134
**Category:** Help
**Tags:** graphics-and-math
**Created:** [February 23, 2023, 5:26pm UTC](https://forum.makecode.com/t/drawing-straight-to-the-screen/18134 "2023-02-23T17:26:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ETesseract](https://avatars.discourse-cdn.com/v4/letter/e/46a35a/32.png) [@ETesseract](https://forum.makecode.com/u/ETesseract)
#### Post date: [February 23, 2023, 5:26pm UTC](https://forum.makecode.com/t/drawing-straight-to-the-screen/18134/1 "2023-02-23T17:26:31Z")

</div>

I’ve been trying to draw to the screen to make GUIs without sprites, but whenever I run the program, nothing happens.

```auto
screen.fillRect(0,0,100,100,2)

```

---

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [February 23, 2023, 6:44pm UTC](https://forum.makecode.com/t/drawing-straight-to-the-screen/18134/2 "2023-02-23T18:44:34Z")

</div>

If you got your screen variable from `image.screenImage()`, you can’t draw to it. That’s only a reference to the screen, and not the object. Try @jwunderl’s extension instead:

> **[GitHub - jwunderl/arcade-sprite-util: A few utility functions for sprites](https://github.com/jwunderl/arcade-sprite-util/)**
>
> A few utility functions for sprites. Contribute to jwunderl/arcade-sprite-util development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [February 23, 2023, 7:23pm UTC](https://forum.makecode.com/t/drawing-straight-to-the-screen/18134/3 "2023-02-23T19:23:33Z")

</div>

I’ll slightly tweak your explanation here because the overall answer is a little subtle – you can draw to that screen, but the default game engine also draw to it all the time, so you have to be careful when drawing so that it doesn’t get immediately erased before it gets the chance to show up (within ~1/30th of a second). If you add my extension he mentioned to your game, it has a few blocks that are useful here because they make it easy to draw to the screen at the right time – in particular  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/2df3825fe98fd2f5dd61a1e079e8dd8c8a9fdf4d.png).

For the most part, the screen you’re using will actually be identical to the parameter in that block; e.g.

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/5d0e332a92fc3cdd001bd932178aa6f5f4059826.png)  
and  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4cbf7d5ab1736bd43cf92f8944f965b617ca5da8.png)

are pretty much the same at the moment – (though you should use the parameter instead for cleanliness / in the future we might update the block for multiple cameras for multiplayer in which case the screen parameter could refer to a given user’s screen instead of just player 1’s)
