Randomly Generated Slope

10 Likes

that really cool

2 Likes

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

2 Likes

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

2 Likes

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.

3 Likes

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!

2 Likes

Good idea I might try and add that

2 Likes

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

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. :blush:

1 Like

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

1 Like

@WoofWoof

Dedication to you for helping with this project :smiley:

3 Likes