# Slopes Physics engine!

**URL:** <https://forum.makecode.com/t/slopes-physics-engine/34810>\
**Category:** Show & Tell\
**Tags:** game, make\
**Created:** [March 22, 2025, 6:55pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810 "2025-03-22T18:55:52Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [March 29, 2025, 5:55pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/21 "2025-03-29T17:55:58Z")

</div>

Sorry, but I am not adding a ground pound. However, if anyone else wants to give it a try, that’s fine by me.

---

<div class="post-metadata">

**Author:** ![Josef](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/josef/32/12457_2.png) [@Josef](https://forum.makecode.com/u/Josef)\
**Post date:** [March 30, 2025, 1:35am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/22 "2025-03-30T01:35:42Z")

</div>

i meant a way to get below the semi solids from on top

---

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [March 30, 2025, 7:57pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/23 "2025-03-30T19:57:44Z")

</div>

By the way, something I’ve been meaning to say for a while, the main physics logic for this project were inspired by [Griffpatch’s tile based platformer tutorials](https://www.youtube.com/watch?v=Fl-LX94Z4Cc&list=PLy4zsTUHwGJIc90UaTKd-wpIH12FCSoLh), the SMB1 physics (as generally seen [here](https://youtu.be/flaEOp5cago?t=106)), and also some of my own previous, inferior attempts to get this kind of physics engine. However, all these different attempts were very laggy if you try to have any real amount of tiles.  
If anyone wants to know about the basics that make the different systems function, all you need to do is ask.

---

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [April 2, 2025, 9:30pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/24 "2025-04-02T21:30:52Z")

</div>

**NEW UPDATE!**  
I have added water to the game now! Also, I have made a few tiny changes behind the scenes that make it generally better for level design, especially if it includes walls that should go offscreen. Here’s the link:

> **[Water Physics](https://arcade.makecode.com/S12119-25473-19345-55331)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

PS, not a new feature, but you can set the TPS (ticks per second, or speed) by pressing T on your keyboard. Also, you can look back at older versions by looking at the older update posts.

---

<div class="post-metadata">

**Author:** ![CodePerson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codeperson/32/32288_2.png) [@CodePerson](https://forum.makecode.com/u/CodePerson)\
**Post date:** [April 3, 2025, 2:56am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/25 "2025-04-03T02:56:53Z")

</div>

This physics engine blew my mind away. Compared to the first version, even at max tps, the game seems a little slow. Is this because there’s more code in the game or just something you set?

---

<div class="post-metadata">

**Author:** ![BotWarrior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/botwarrior/32/25328_2.png) [@BotWarrior](https://forum.makecode.com/u/BotWarrior)\
**Post date:** [April 3, 2025, 3:00am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/26 "2025-04-03T03:00:56Z")

</div>

Cool! I really love how you did the water!

---

<div class="post-metadata">

**Author:** ![Josef](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/josef/32/12457_2.png) [@Josef](https://forum.makecode.com/u/Josef)\
**Post date:** [April 3, 2025, 11:45am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/27 "2025-04-03T11:45:42Z")

</div>

WOOW THATS SO COOL nice job man

---

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [April 3, 2025, 4:53pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/28 "2025-04-03T16:53:27Z")

</div>

It’s probably just because of how the code isn’t necessarily the most optimized, so the moderately sloppy code is most likely what causes the lag.

---

<div class="post-metadata">

**Author:** ![BotWarrior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/botwarrior/32/25328_2.png) [@BotWarrior](https://forum.makecode.com/u/BotWarrior)\
**Post date:** [April 3, 2025, 9:10pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/29 "2025-04-03T21:10:31Z")

</div>

Way way better than I could do…

---

<div class="post-metadata">

**Author:** ![Fangstor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fangstor/32/33185_2.png) [@Fangstor](https://forum.makecode.com/u/Fangstor)\
**Post date:** [May 25, 2025, 5:32pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/30 "2025-05-25T17:32:39Z")

</div>

I am acually making a port of Super Mario Bros on makecode arcade with its actual physics  
and this helped me out a lot

---

<div class="post-metadata">

**Author:** ![Fangstor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fangstor/32/33185_2.png) [@Fangstor](https://forum.makecode.com/u/Fangstor)\
**Post date:** [May 26, 2025, 3:37am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/31 "2025-05-26T03:37:28Z")

</div>

Also here is the demo of it

 ![arcade-SMB1-Makecode-Recreation (1)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/e/9e6409acbe839e878a02da5955dbc50ee787829f.png)

Also it is not finished since it is a demo but I managed to get the tiles a mario to the game.  
But since it is on makecode arcade, there are some restrictions:

1. I cant use the NES pallete. I could but since there’s only 16 colors, I have to use otherwise.

2. Mario looks weird because of two resons:

3. since I’m using the arcade pallete, I can’t use brown for Mario’ shirt cause it will blend with the color of the ground tile so I used the dark purple for Mario.

4. I have to use multiple images because if I try to use a sprite, the sprite amount will build up in the stats which the FPS will decrease.

Anyways that’s it…there are no enemies in the demo so look out for that.

---

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [May 26, 2025, 3:44am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/32 "2025-05-26T03:44:12Z")

</div>

If you’re doing a port of SMB1, then, unless you add slopes or any other non-full tile, you actually can just simply directly use the value that I index into the animation for the function that gets the collision data for each tile, and also make it so that it only looks for the number for the tile instead of looking at the color of the corresponding collision image.  
In other words, if you aren’t adding slopes or any other blocks that don’t take up the entire tile, then you can just return the value that the tile that is on that point inputs into the animation when detecting collision. Also, if you ever need to do an action that only works in one direction, then you can do that by only looking for it with one hit-bit (the points in which it detects collision. )

---

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [May 27, 2025, 2:08am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/33 "2025-05-27T02:08:07Z")

</div>

You know, this physics engine was actually designed to be like SMB1. Also, here’s some feedback on things that I have noticed that you could improve:

- The image that I was setting for the player, you could’ve just used that to set the player’s sprite
- You could make it easier to get each of the sprites for Mario by setting a value to a number that you then use as an index into an animation that holds all of Mario’s frames
- For the jump, it is supposed to be that the jump frame is active when you are in the air, so it should turn on when you start jumping and turn off when you land.
- You can delete any redundant collision frames in the animation, making sure that the frames match up with the numbers you set each tile to (first frame is 0, count up by 1 for each frame after)
- You can actually just remove the part where it looks for a frame in the animation and then just make it so that rather than reading a pixel of the result it then just reads the result
- Btw, the animations are actually just lists of images, if you wanted to know. Also, the “advanced” tab isn’t complicated, I think that it might just be that they thought that brand-new coders might not be able to quite understand how they work
- If you want the water to have it so that you can’t go to the top, you should just dedicate a new color to being semisolid with solid to the top by adding the color to the solids list for the head but not any of the other hit-bits (points of collision)

Remember: I am not trying to say that you are a bad coder, all this is just me letting you know of ways that I know to improve it. Also, I just put them in the order I thought of them.

---

<div class="post-metadata">

**Author:** ![Fangstor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fangstor/32/33185_2.png) [@Fangstor](https://forum.makecode.com/u/Fangstor)\
**Post date:** [May 27, 2025, 10:52pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/34 "2025-05-27T22:52:46Z")

</div>

oh yeah thanks for reminding me. I was actually struggling on the animations…also I am still continuing on this project.

---

<div class="post-metadata">

**Author:** ![Marlio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/marlio/32/21270_2.png) [@Marlio](https://forum.makecode.com/u/Marlio)\
**Post date:** [May 28, 2025, 9:55pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/35 "2025-05-28T21:55:59Z")

</div>

Please make sure to post updates, I’d really like to see what progress you make, even if you don’t manage to finish it all the way.

---

<div class="post-metadata">

**Author:** ![Josef](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/josef/32/12457_2.png) [@Josef](https://forum.makecode.com/u/Josef)\
**Post date:** [June 3, 2025, 6:44pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/36 "2025-06-03T18:44:17Z")

</div>

Arcade pallets just sounds like a pain

---

<div class="post-metadata">

**Author:** ![goobermakers](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/goobermakers/32/36782_2.png) [@goobermakers](https://forum.makecode.com/u/goobermakers)\
**Post date:** [October 29, 2025, 7:11pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/37 "2025-10-29T19:11:54Z")

</div>

Do you know how I could do state-based animations in this engine?

---

<div class="post-metadata">

**Author:** ![coppercode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/coppercode/32/26022_2.png) [@coppercode](https://forum.makecode.com/u/coppercode)\
**Post date:** [October 29, 2025, 10:53pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/38 "2025-10-29T22:53:22Z")

</div>

hi is there a way to make this in 3d

---

<div class="post-metadata">

**Author:** ![Rune](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rune/32/18951_2.png) [@Rune](https://forum.makecode.com/u/Rune)\
**Post date:** [October 31, 2025, 2:33am UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/39 "2025-10-31T02:33:08Z")

</div>

Short answer: No.

Long answer: not with raycasting, as that 3D is just an illusion. If you knew how things like the Doom Engine worked, you might be able to pull off a laggy version in makecode,

---

<div class="post-metadata">

**Author:** ![coppercode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/coppercode/32/26022_2.png) [@coppercode](https://forum.makecode.com/u/coppercode)\
**Post date:** [October 31, 2025, 6:17pm UTC](https://forum.makecode.com/t/slopes-physics-engine/34810/40 "2025-10-31T18:17:53Z")

</div>

ok thanks I’ll look through the makecode form

[Previous page](https://forum.makecode.com/t/slopes-physics-engine/34810.md?page=1)

[Next page](https://forum.makecode.com/t/slopes-physics-engine/34810.md?page=3)
