# Randomly Generated Slope

**URL:** https://forum.makecode.com/t/randomly-generated-slope/33686
**Category:** Show & Tell
**Created:** [February 8, 2025, 8:52am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686 "2025-02-08T08:52:05Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Fixitude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fixitude/32/28576_2.png) [@Fixitude](https://forum.makecode.com/u/Fixitude)
#### Post date: [February 8, 2025, 8:52am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/1 "2025-02-08T08:52:05Z")

</div>

> **[Downhill2d](https://arcade.makecode.com/34552-12593-91407-73832)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![CodeOnTheCob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codeonthecob/32/19306_2.png) [@CodeOnTheCob](https://forum.makecode.com/u/CodeOnTheCob)
#### Post date: [February 9, 2025, 12:00am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/2 "2025-02-09T00:00:56Z")

</div>

that really cool

---

<div class="post-metadata">

### Author: ![Fixitude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fixitude/32/28576_2.png) [@Fixitude](https://forum.makecode.com/u/Fixitude)
#### Post date: [February 9, 2025, 12:03am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/3 "2025-02-09T00:03:15Z")

</div>

Just FYI this is randomly generated but there is an error which makes it not random if anyone could look into this error and send me back the game I would be very happy

---

<div class="post-metadata">

### Author: ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)
#### Post date: [February 9, 2025, 12:12am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/4 "2025-02-09T00:12:37Z")

</div>

Wow the generation looks really cool / realistic! Are you adding collisions next? ⛰

---

<div class="post-metadata">

### Author: ![Fixitude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fixitude/32/28576_2.png) [@Fixitude](https://forum.makecode.com/u/Fixitude)
#### Post date: [February 9, 2025, 2:29am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/5 "2025-02-09T02:29:23Z")

</div>

Thanks, I have kind of reached a stand still with this code because it is very complicated so I am hoping someone might look into it but I think it could turn out to be a very good game.

---

<div class="post-metadata">

### Author: ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)
#### Post date: [February 9, 2025, 4:08am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/6 "2025-02-09T04:08:40Z")

</div>

Maybe when the player overlaps the image, you can set the player’s velocity to -50, so it bounces up in the air and then starts to accelerate back down!

---

<div class="post-metadata">

### Author: ![Fixitude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fixitude/32/28576_2.png) [@Fixitude](https://forum.makecode.com/u/Fixitude)
#### Post date: [February 9, 2025, 7:18am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/7 "2025-02-09T07:18:04Z")

</div>

Good idea I might try and add that

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [February 11, 2025, 2:11am UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/8 "2025-02-11T02:11:11Z")

</div>

Hi!! I thought this was really cool so here’s your fixed code:

> **[Downhill2d (fixed)](https://arcade.makecode.com/S50094-50332-25579-77418)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Basically, the thing that was wrong was this one “repeat (10): (elevations) insert (startElevation) at beginning” bit. I forget where it was, but it was kinda forcing the slope to be right there and then the random ups and downs were only getting added to that instead…? That’s a horrible explanation but basically when I removed that bit everything was fine, except the slope ended like 10 pixels from the right wall and so it looked weird. To fix that, I basically made the heights array go to 170 instead of 160, then shifted the smoothing code to the right so that the left most pixel has the 10 extra values off the screen to get its smoothness. Horrible explanation, but it works, so yeah. I also changed your player-under-slope code to correctly adjust for the 10 pixel change and you’ll notice I brought back the blue top line cause I like how it looks. 😊

---

<div class="post-metadata">

### Author: ![Fixitude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fixitude/32/28576_2.png) [@Fixitude](https://forum.makecode.com/u/Fixitude)
#### Post date: [February 11, 2025, 12:57pm UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/9 "2025-02-11T12:57:53Z")

</div>

Thanks you so much!!! I am very excited and happy that you fixed it 😁 if you ever need help with anything I am more than happy to help

---

<div class="post-metadata">

### Author: ![Fixitude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fixitude/32/28576_2.png) [@Fixitude](https://forum.makecode.com/u/Fixitude)
#### Post date: [February 11, 2025, 12:58pm UTC](https://forum.makecode.com/t/randomly-generated-slope/33686/10 "2025-02-11T12:58:25Z")

</div>

@WoofWoof

> **[Downhill2d Dedication To Woof Woof](https://arcade.makecode.com/S83497-43827-93700-47073)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Dedication to you for helping with this project 😃
