# Constraining a sprite between values - Fishing UI

**URL:** <https://forum.makecode.com/t/constraining-a-sprite-between-values-fishing-ui/7854>\
**Category:** Help\
**Created:** [May 4, 2021, 11:55pm UTC](https://forum.makecode.com/t/constraining-a-sprite-between-values-fishing-ui/7854 "2021-05-04T23:55:49Z")\
**Posts on this page:** 3\
**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 4, 2021, 11:55pm UTC](https://forum.makecode.com/t/constraining-a-sprite-between-values-fishing-ui/7854/1 "2021-05-04T23:55:49Z")

</div>

Hello there!

I’m making a survival game and wanted to make something like Stardew Valley’s fishing mechanism.

Like so:  
[![](https://media1.giphy.com/media/UuGXyYYAbCMSI/giphy.gif) ](https://media1.giphy.com/media/UuGXyYYAbCMSI/giphy.gif)

> **[wateranim](https://arcade.makecode.com/69864-92329-91740-47196)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I’ve managed to make the sprites move… but the problem I’m having is how to constrain the yellow target sprite between the range of the other sprite. I thought about using a game update… or constrain (math block) but not sure where to implement this.

(Also, I haven’t finished setting up the fish nor properly aligning the yellow sprite in this version)

Please help!

Kind regards  
Woody

---

<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 21, 2021, 10:35pm UTC](https://forum.makecode.com/t/constraining-a-sprite-between-values-fishing-ui/7854/2 "2021-05-21T22:35:16Z")

</div>

@richard @UnsignedArduino

Could you help me with this please?

---

<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 21, 2021, 11:07pm UTC](https://forum.makecode.com/t/constraining-a-sprite-between-values-fishing-ui/7854/3 "2021-05-21T23:07:15Z")

</div>

Nevermind! I cracked it after drinking _LOTS_of coffeeeee\*\*

> **[FishingGameUI](https://arcade.makecode.com/93221-83125-87541-12920)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Is there a better way though?
