# Mega-elastic collisions

**URL:** <https://forum.makecode.com/t/mega-elastic-collisions/815>\
**Category:** Arcade\
**Created:** [November 25, 2019, 2:15pm UTC](https://forum.makecode.com/t/mega-elastic-collisions/815 "2019-11-25T14:15:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjw](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kjw](https://forum.makecode.com/u/kjw)\
**Post date:** [November 25, 2019, 2:15pm UTC](https://forum.makecode.com/t/mega-elastic-collisions/815/1 "2019-11-25T14:15:07Z")

</div>

I left some code running with some simple physics and noticed that a bouncing ball got higher. This was on a hardware device and my first guess was that it was something to do with imprecision of 32bit floating point. However, I left it running in browser and I think it degrades at a very similar rate if not identical.

Leave [https://makecode.com/\_53r2UfCfzJ7x](https://makecode.com/_53r2UfCfzJ7x) running for a few minutes and you should notice the balls get higher and higher and eventually bounce off the top wall. This is in Chrome 78.0.3904.108. Would be useful if someone else could confirm this, it could just be my balls are bouncier than others.

---

<div class="post-metadata">

**Author:** ![kjw](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kjw](https://forum.makecode.com/u/kjw)\
**Post date:** [November 25, 2019, 9:13pm UTC](https://forum.makecode.com/t/mega-elastic-collisions/815/2 "2019-11-25T21:13:30Z")

</div>

Same on Firefox and a Pygamer, btw.

The gravity isn’t turned on until 18 seconds have passed in case that’s not obvious!

Problem occurs in both production beta `0.14.9 5.21.14` and beta beta `0.14.43 5.28.32`.

---

<div class="post-metadata">

**Author:** ![kjw](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kjw](https://forum.makecode.com/u/kjw)\
**Post date:** [November 26, 2019, 12:31am UTC](https://forum.makecode.com/t/mega-elastic-collisions/815/3 "2019-11-26T00:31:47Z")

</div>

FYI, I just set three other sprites in a minimal program to `vx` of 0.17, 0.18 and 0.19. The sprite with velocity 0.17 doesn’t move most of the time, 0.18 goes at about a 1/5 of the speed of 0.19 in the simulator.

See [https://makecode.com/\_iaTaDhH8Ah28](https://makecode.com/_iaTaDhH8Ah28) for checking different low velocities. Works well with [https://www.youtube.com/watch?v=Y4QbJRAWvRU](https://www.youtube.com/watch?v=Y4QbJRAWvRU) playing in the background.
