# Sprite in continuous fall

**URL:** <https://forum.makecode.com/t/sprite-in-continuous-fall/1237>\
**Category:** Arcade\
**Created:** [February 19, 2020, 12:00am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237 "2020-02-19T00:00:22Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 19, 2020, 12:00am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/1 "2020-02-19T00:00:23Z")

</div>

I’m having a fantastic time learning new skills and relearning some old skills with Arcade.

I’ve run into a roadblock in my platformer upon using the “place Sprite on top of random tile” block.

Approximately half the time this works fine as expected. However, often when the sprite is transported to the new location, it continuously accelerates through all the walls downward into the abyss and I must do a reset.

Is this a known bug or am I possibly missing something?

---

<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:** [February 19, 2020, 12:15am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/2 "2020-02-19T00:15:21Z")

</div>

Could you share your code?

---

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 19, 2020, 1:07am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/3 "2020-02-19T01:07:46Z")

</div>

I will share as soon as I figure out how. 😊

---

<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:** [February 19, 2020, 1:20am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/4 "2020-02-19T01:20:36Z")

</div>

If you open up your game, you can click “share” in the top bar to publish it. Here’s a gif of me doing that:

 ![2020-02-18 17.19.24](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/f2964f29e67e215a20cdcad3393797a5bc93d70b.gif)

Paste the link in the last dialog here!

---

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 19, 2020, 3:27am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/5 "2020-02-19T03:27:32Z")

</div>

Thank you. I’ve been attempting that. When I try to publish and share I’m getting “bad http status code 413”. Is my code to large?

---

<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:** [February 19, 2020, 6:24pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/6 "2020-02-19T18:24:55Z")

</div>

Huh, that might be the case! Well, if you can go into the JavaScript tab and copy-paste the code here that might work

---

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 19, 2020, 10:15pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/7 "2020-02-19T22:15:10Z")

</div>

It’s quite a bit of code with many levels and background images. I’ve got it set up to start at level 9 as that is where I am first noticing the problem. When on top of an “up arrow” tile, pressing the up button places the sprite on the “out” tile. This is the moment where sometimes it works, and other times the sprite just continues to accelerate down through walls.

Hope this attachment works.

(Attachment Bailey’s Fun.txt is missing)

---

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 19, 2020, 10:26pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/8 "2020-02-19T22:26:34Z")

</div>

It’s quite a bit of code with many levels and background images. I’ve got it set up to start at level 9 as that is where I am first noticing the problem. When on top of an “up arrow” tile, pressing the up button places the sprite on the “out” tile. This is the moment where sometimes it works, and other times the sprite just continues to accelerate down through walls.

Hope this attachment works.

![arcade-Baileys-Fun (16).png](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/6067b130102f61973d96935c667bd18cc33da395.png)

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [February 19, 2020, 10:56pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/9 "2020-02-19T22:56:19Z")

</div>

You can also export your game to GitHub using the GitHub button next to the save button.

---

<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:** [February 19, 2020, 11:00pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/10 "2020-02-19T23:00:02Z")

</div>

Thanks for reporting this; that’s a great bug! Let me try to explain what’s going on here:

MakeCode has logic for when sprites “clip” into walls to prevent collisions from happening. We do that so if you move a sprite inside a wall by setting x/y directly, it won’t immediately bounce back out again. So, if a sprite is teleported inside of a wall it will cease to collide with walls until it exits the wall and collisions are turned back on.

The reason this is triggering in your game is because your dog sprite is 16 pixels wide. When the game teleports the dog to a tile next to a wall the physics engine is mistakenly detecting that a collision is happening and so wall collisions are turned off for the dog. You can prevent the bug by making your dog 15x15 pixels instead of 16x16.

I’ll open an issue in our bug tracker to make a fix for this.

Thanks @jwunderl for figuring it out!

---

<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:** [February 19, 2020, 11:13pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/11 "2020-02-19T23:13:42Z")

</div>

Here’s the issue: [https://github.com/microsoft/pxt-arcade/issues/1753](https://github.com/microsoft/pxt-arcade/issues/1753)

---

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 20, 2020, 2:05am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/12 "2020-02-20T02:05:58Z")

</div>

I thank you very much for all of the quick responses. Reducing the pixel size seems to have eliminated the problem. However, now my sprite jitters a lot when hitting a side wall. I believe this issue was the reason I had made my sprite 16 pixels wide to begin with. Thoughts?

---

<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:** [February 20, 2020, 9:55pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/13 "2020-02-20T21:55:19Z")

</div>

Hmmmm… not sure. Could be a bug with the physics detection. Could also be caused by animations. Does your sprite change size in its walking animations?

---

<div class="post-metadata">

**Author:** ![scottphx75](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@scottphx75](https://forum.makecode.com/u/scottphx75)\
**Post date:** [February 21, 2020, 11:06pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/14 "2020-02-21T23:06:40Z")

</div>

Yes, I did have it change sizes. I have fixed that and now all seems to work well. Thank you so much.

---

<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:** [February 21, 2020, 11:48pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/15 "2020-02-21T23:48:46Z")

</div>

No problem! Thanks for the update!

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [November 15, 2020, 10:04am UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/16 "2020-11-15T10:04:31Z")

</div>

@richard

I have a similar issue where I place an enemy sprite with x,y (relative to where the player is), and when the position happens to be a wall, it falls through. When I place the sprite a use the function 'is sprite hitting wall (left,right,top or bottom) and try move it further left or right. This function does not fire. Is that because of the issue explained above, or because the collision detection does not happen until after the current game update event?  
As a workaround I will check for sprites whose top is greater than the screen height, and probably destroy them.

---

<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:** [November 16, 2020, 5:18pm UTC](https://forum.makecode.com/t/sprite-in-continuous-fall/1237/17 "2020-11-16T17:18:23Z")

</div>

When sprites are placed in walls, they go into “clipping” mode and will not collide again until they are fully outside the wall.
