# Slope collision test

**URL:** https://forum.makecode.com/t/slope-collision-test/1832
**Category:** Game Design
**Created:** [April 25, 2020, 2:00am UTC](https://forum.makecode.com/t/slope-collision-test/1832 "2020-04-25T02:00:42Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![reyhanPanci256](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/reyhanpanci256/32/1770_2.png) [@reyhanPanci256](https://forum.makecode.com/u/reyhanPanci256)
#### Post date: [April 25, 2020, 2:00am UTC](https://forum.makecode.com/t/slope-collision-test/1832/1 "2020-04-25T02:00:42Z")

</div>

> **[slope collision test](https://arcade.makecode.com/93495-20158-68840-18373)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

donic the hedgeduck

---

<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: [April 27, 2020, 5:23pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/2 "2020-04-27T17:23:27Z")

</div>

Awesome! I did something similar a while ago but I never ended up packaging it up.

> **[slope-physics-demo](https://arcade.makecode.com/80413-14046-19459-41458)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [June 27, 2020, 8:30pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/3 "2020-06-27T20:30:28Z")

</div>

It’s not letting me view the code.  
How did you make the wheel of platforms turn so smoothly?  
Did you use sin cos tan?

---

<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: [July 2, 2020, 10:36pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/4 "2020-07-02T22:36:14Z")

</div>

Yep! The formula looks something like this:

```auto
x = cx + Math.cos(game.runtime() / 1000) * radius
y = cy + Math.sin(game.runtime() / 1000) * radius

```

- cx, cy is the center of the circle
- radius is distance from the center
- 1000 is just to convert the runtime into seconds. Make that number bigger to rotate slower, and smaller to rotate faster

In blocks, you can find the runtime in the `game` toolbox. It’s the one that says `time since start (ms)`.

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [July 2, 2020, 10:36pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/5 "2020-07-02T22:36:34Z")

</div>

thanks!

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [July 2, 2020, 10:36pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/6 "2020-07-02T22:36:55Z")

</div>

This really helps. 😌

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [July 2, 2020, 10:38pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/7 "2020-07-02T22:38:14Z")

</div>

So do this on a game update every \_\_\_ ms?

---

<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: [July 2, 2020, 10:48pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/8 "2020-07-02T22:48:56Z")

</div>

Yep, but if you want it to be smooth then you should probably just use an `on game update` (no interval)

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [July 3, 2020, 12:22am UTC](https://forum.makecode.com/t/slope-collision-test/1832/9 "2020-07-03T00:22:25Z")

</div>

Okay!

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [July 3, 2020, 12:38am UTC](https://forum.makecode.com/t/slope-collision-test/1832/10 "2020-07-03T00:38:24Z")

</div>

> [@richard](#):
>
> ```auto
> x = cx + Math.cos(game.runtime() / 1000) * radius
> y = cy + Math.sin(game.runtime() / 1000) * radius
> 
> ```

How did you make many platforms? How did you make a sprite stick to 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: [July 6, 2020, 4:31pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/11 "2020-07-06T16:31:54Z")

</div>

Ah, that’s tougher. I made my own custom physics engine for that demo. This is not something that you can do in blocks.

Basically, every platform is a “mini tilemap” with its own collisions defined. I also store a list of “riders”, which are sprites that have landed on the platform. When I move the platforms, I also move all of the riders for that platform. A sprite stops being a rider when thy no longer collide with it anymore.

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [July 6, 2020, 5:48pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/12 "2020-07-06T17:48:37Z")

</div>

Okay, that seems a bit to difficult for me. 😆

---

<div class="post-metadata">

### Author: ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)
#### Post date: [July 16, 2020, 8:08am UTC](https://forum.makecode.com/t/slope-collision-test/1832/13 "2020-07-16T08:08:03Z")

</div>

I made this 😕

---

<div class="post-metadata">

### Author: ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)
#### Post date: [July 17, 2020, 8:24am UTC](https://forum.makecode.com/t/slope-collision-test/1832/14 "2020-07-17T08:24:44Z")

</div>

like i copied it  
and it got deleted somehow

---

<div class="post-metadata">

### Author: ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)
#### Post date: [July 18, 2020, 3:19am UTC](https://forum.makecode.com/t/slope-collision-test/1832/15 "2020-07-18T03:19:26Z")

</div>

Umm this is too cool

---

<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: [September 29, 2020, 9:59pm UTC](https://forum.makecode.com/t/slope-collision-test/1832/16 "2020-09-29T21:59:17Z")

</div>

@reyhanPanci256

I think your code is awesome, and makes a good use tiles and a tile map. I found an issue that places donic outside the game (see screenshot below)

![arcade-slope-collision-test](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/3/35479768c6ac90a9455de3f93f628cb0bc9fd544.png)

I think it has to do with the code within the sprite.overlap functions and specifically:

sprite.y += -5

The player sprite can fall out of the screen when moving down a slope, right at the ‘corner’ of the slope (so where the flat tile meets the sloping tile) It happens at both sides. At this point the code does not see that the player overlaps a tile sprite and is sent hurtling down the screen.

---

<div class="post-metadata">

### Author: ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)
#### Post date: [March 3, 2021, 1:16am UTC](https://forum.makecode.com/t/slope-collision-test/1832/17 "2021-03-03T01:16:28Z")

</div>

Wait, is it possible to make a 1x1 tilemap extension? Maybe call it micromaps.

---

<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: [March 3, 2021, 1:21am UTC](https://forum.makecode.com/t/slope-collision-test/1832/18 "2021-03-03T01:21:17Z")

</div>

This came up [in another thread](https://forum.makecode.com/t/minimap-extension-beta/1709/14) some time ago but the physics engine in arcade really can’t support 1x1 tilemaps. It would be way too slow, unfortunately.

That being said, I know @GameGod was working on something: [1x1 tilemaps](https://forum.makecode.com/t/1x1-tilemaps/5268)
