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


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?

I don’t think you cannot get around this.

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

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

I stand corrected thought :slight_smile:

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:

Here’s a link to the example:

1 Like