Horizontal compass

Hi, I’m new at this and I’m trying to create a Horizontal compass, something like this:

but I can’t find out which UI components should I use, I’m thinking on using an image resource for the indicators inside a 2D screen element but don’t know how to make it “recycle” the image once it reachs it’s boundaries.

Any ideas?

Could you explain this further?

If the image is wider than the mask, you can use 2 UI Elements that wrap around each other when moving.

See this link as an example: https://gamedev.stackexchange.com/questions/140154/programmatically-creating-a-continuous-scrolling-background-in-game-maker-studi

1 Like

@DevilZ I mean the following scenario:
let’s think this is my compass image asset
|1 · 2 · 3 · |
what I want is that once it reachs the right end (3 ·) start over from the other end attached to this end (3 · 1 · 2 · 3) and same for the other end (1 ·) and attach it back to the start (1 · 2 · 3 · 1)

In that case, you will need to detect when the pointer reaches the end. Then as @yaustar said, you move the pointer to the 2nd UI element that is wrapped around the first.

ok, so basically the approach here is to add dynamically N times the asset to its start and end?


great, thanks @DevilZ and @yaustar, but then what are the performance implications on doing that?

1 Like

You would have to disable the entities which cannot be seen by the camera at a given time to improve performance.

What do you mean by N times? You only need two assuming that the image used is the whole compass.

If the compass image is split into 4 assets due to size for example, you should only need one instance of each.

you’re right @yaustar I’ll split it into 4 pices and then recycle them.

Not sure, but can’t it be done as the waves effect rolling the texture?
in this project used in water model

this still a work in progress but I can’t figure out how to remove that “glitch” after reaching one of the image asset’s limits

1 Like

it was easiest than I thought, if someone wants to take a look I will keep the project.