Can anyone optimize this please?

I tried making it so that the collision would still work even if the blocks are elongated but it wouldn’t work and now its too laggy because there are too many walls, can anyone fix this? rpg game4-1-2023_15-26-57.wick (31.3 KB)

The reason why you can’t change the size of the walls without ruining the collision is because you’re using the width/ height of the actual walls to determine how far away to push the player in the opposite direction.

There are two ways to fix this, the easiest one would be to replace “this.width” with


and “this.height” with


After you do that, the update script should look like this:

With this, you should be able to resize the walls freely without breaking the collision system.

You currently have around 112 wall clips, if you were to resize all the walls as needed you can bring that down to 18.

rpg game4-2-2023_14-14-09.wick (9.7 KB)

thank you for helping

1 Like