# Creating a UI (Overlay) - Relative to camera - without ghosting the sprites

**URL:** <https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268>\
**Category:** Help\
**Created:** [May 22, 2021, 11:49pm UTC](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268 "2021-05-22T23:49:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WoodysWorkshop](https://avatars.discourse-cdn.com/v4/letter/w/ea666f/32.png) [@WoodysWorkshop](https://forum.makecode.com/u/WoodysWorkshop)\
**Post date:** [May 22, 2021, 11:49pm UTC](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268/1 "2021-05-22T23:49:46Z")

</div>

Hi,

Thinking about how I could use this fishing mini-game in another game… I whipped this up quick.

I noticed that when sprites are ‘relative to camera’ (which is great for creating User Interfaces [UIs] and overlays) that the sprites becomes ‘ghosted’ so they cannot overlap anymore…

How can I get around this?

> **[FishingGameUIV1.1](https://arcade.makecode.com/24805-12514-00861-77371)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [May 23, 2021, 12:32am UTC](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268/2 "2021-05-23T00:32:42Z")

</div>

> [@WoodysWorkshop](#):
>
> I noticed that when sprites are ‘relative to camera’ (which is great for creating User Interfaces [UIs] and overlays) that the sprites becomes ‘ghosted’ so they cannot overlap anymore…

I don’t think you cannot get around this.

---

<div class="post-metadata">

**Author:** ![WoodysWorkshop](https://avatars.discourse-cdn.com/v4/letter/w/ea666f/32.png) [@WoodysWorkshop](https://forum.makecode.com/u/WoodysWorkshop)\
**Post date:** [May 24, 2021, 7:14am UTC](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268/3 "2021-05-24T07:14:17Z")

</div>

Hmm… how about using the Sprite Utils range feature instead of the vanilla ‘overlap’?

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [May 24, 2021, 4:40pm UTC](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268/4 "2021-05-24T16:40:05Z")

</div>

Yes, you can…but you can’t store references to functions in a sprite so your code gets really big ☹

I stand corrected thought 🙂

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [May 24, 2021, 4:51pm UTC](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268/5 "2021-05-24T16:51:34Z")

</div>

The easiest way to do this would be to not use “relative to camera”, but instead position the sprites on every frame yourself! We have some camera blocks in the scene category that are useful for this.

One note: this won’t work inside an “on game update” because the camera doesn’t get updated until _after_ that code gets run. Luckily, I added a block to @jwunderl’s jwunderl/arcade-sprite-util to make this easier:

 ![Screen Shot 2021-05-24 at 9.48.49 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/2f7584ab722b218f57d9bc1cb722ecd37476e2fb.png)

Here’s a link to the example: [https://makecode.com/\_9FkEaFey5eC9](https://makecode.com/_9FkEaFey5eC9)
