# How to make a sprite move to the right and left, BUT when in contact with other sprites, would not be repelled from them?

**URL:** <https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439>\
**Category:** Questions about Thunkable X\
**Created:** [February 10, 2022, 12:28pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439 "2022-02-10T12:28:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonova.322.228.148](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@simonova.322.228.148](https://community.thunkable.com/u/simonova.322.228.148)\
**Post date:** [February 10, 2022, 12:28pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/1 "2022-02-10T12:28:25Z")

</div>

How to make a sprite move to the right and left, BUT when in contact with other sprites, would not be repelled from them?? For me, either the sprite is immobilized and then does not move when it touches other sprites, or it moves, but then it moves when it touches others. Help me ple  
 ![3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/4/7410f6d9427f5115b6857fe30c23b5a9c573a541.gif)  
ase

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 10, 2022, 3:52pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/2 "2022-02-10T15:52:42Z")

</div>

I would try enabling Ignore Gravity in the sprite’s properties and also constraining the sprite’s y position to its starting y position. You can do that by setting a variable to its y position and then constraining its y position to that variable.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [February 10, 2022, 4:47pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/3 "2022-02-10T16:47:15Z")

</div>

Dear @tatiang appreciate if you can close  
[https://community.thunkable.com/t/hello-how-can-i-make-the-sprite-move-left-and-right-all-the-time/1726296](https://community.thunkable.com/t/hello-how-can-i-make-the-sprite-move-left-and-right-all-the-time/1726296)

As it seems by the same member and asking the same thing.

---

<div class="post-metadata">

**Author:** ![simonova.322.228.148](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@simonova.322.228.148](https://community.thunkable.com/u/simonova.322.228.148)\
**Post date:** [February 10, 2022, 5:24pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/4 "2022-02-10T17:24:33Z")

</div>

Ignore Gravity is currently enabled. I did not quite understand how to make it so that y does not change. Can you send a code sample please?  
I am attaching a request for the project:  
[https://x.thunkable.com/copy/f3aa8d4f0ea64351eef706096dd8c56c](https://x.thunkable.com/copy/f3aa8d4f0ea64351eef706096dd8c56c)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 10, 2022, 5:28pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/5 "2022-02-10T17:28:41Z")

</div>

I thought there was a constrain block but I’m not seeing it. You could try this:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/f/2f9d4a2d43cd09ce38fedaf6811bb8a3566a0bf2.png)

---

<div class="post-metadata">

**Author:** ![simonova.322.228.148](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@simonova.322.228.148](https://community.thunkable.com/u/simonova.322.228.148)\
**Post date:** [February 10, 2022, 11:00am UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/6 "2022-02-10T11:00:29Z")

</div>

This code is not working  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/9/0930cd3026b9ddf1e06cf16b3afa245ee16924b8.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 10, 2022, 4:50pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/7 "2022-02-10T16:50:01Z")

</div>

@jared can you merge this with [How to make a sprite move to the right and left, BUT when in contact with other sprites, would not be repelled from them?](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439)?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 10, 2022, 5:06pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/8 "2022-02-10T17:06:01Z")

</div>

Try this:

[https://x.thunkable.com/copy/3961e1540c575a0d2287655bbfedc6b1](https://x.thunkable.com/copy/3961e1540c575a0d2287655bbfedc6b1)

---

<div class="post-metadata">

**Author:** ![simonova.322.228.148](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@simonova.322.228.148](https://community.thunkable.com/u/simonova.322.228.148)\
**Post date:** [February 10, 2022, 8:38pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/9 "2022-02-10T20:38:40Z")

</div>

the link doesn’t work unfortunately(

---

<div class="post-metadata">

**Author:** ![simonova.322.228.148](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@simonova.322.228.148](https://community.thunkable.com/u/simonova.322.228.148)\
**Post date:** [February 10, 2022, 8:42pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/10 "2022-02-10T20:42:06Z")

</div>

What should the variable be equal to when initialized?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 10, 2022, 9:47pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/11 "2022-02-10T21:47:43Z")

</div>

> [@simonova.322.228.148](#):
>
> What should the variable be equal to when initialized?

I almost never initialize variables. You can just leave it blank.

> [@simonova.322.228.148](#):
>
> the link doesn’t work unfortunately(

I wonder if you are at your limit for projects, perhaps? If not, try this link:

[https://x.thunkable.com/copy/062f688518429b9861c49ef769b723a3](https://x.thunkable.com/copy/062f688518429b9861c49ef769b723a3)

Here are the blocks from my project:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/1/d1ba4ce781d2484f269856d623d69387eb6fc3eb.png)

---

<div class="post-metadata">

**Author:** ![simonova.322.228.148](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@simonova.322.228.148](https://community.thunkable.com/u/simonova.322.228.148)\
**Post date:** [February 10, 2022, 11:29pm UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/12 "2022-02-10T23:29:10Z")

</div>

☹ the project limit has not been exceeded  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/0/109ce7f35bb9b073e91baf0662e62928a4ad075a.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 11, 2022, 12:21am UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/13 "2022-02-11T00:21:24Z")

</div>

Hmm… I’m not sure what to say. @muneer, are you able to open the link?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [February 11, 2022, 2:48am UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/14 "2022-02-11T02:48:24Z")

</div>

> [@tatiang](#):
>
> are you able to open the link?

Yes, I can. The project name is `Canvas sandbox copy`.

**[Update]**  
@tatiang, I just noticed that you flagged this project as **private**. I think this is the reason he is not able to remix it. Private projects can only be remixed by PRO members.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/7/470109f8709926b0966205ae9bc5eacb5d432990.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [May 12, 2022, 2:49am UTC](https://community.thunkable.com/t/how-to-make-a-sprite-move-to-the-right-and-left-but-when-in-contact-with-other-sprites-would-not-be-repelled-from-them/1726439/15 "2022-05-12T02:49:00Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
