RunFaps
shaunjs
shaunjs patreon

Slopes Tutorial out tomorrow!

🕑 Added 2017-09-28 19:02:44 +0000 UTC
Slopes Tutorial out tomorrow!

Comments

Since I'm sat here watching it render the last few frames so I can set it encoding and be done I'll walk you through it: 1. build a height table out of your collision tiles (a global array containing the height of each column). This is done dynamically at the start of the game by drawing them to a surface and using a for loop to check for coloured pixels. 2. when you collide horizontally, ignore the bottom corner pixels if you're currently on a slope (by getting the current tile index) to allow you to transition smoothly from slope to solid. 3. when you collide vertically, if you're on a slope, skip your regular collision walking up: 4. either way after this, compare your in-tile y position against the appropriate entry in the height table to see how far you are inside the ground (if at all). Move so that this distance is -1 above the ground. walking down: 5. if you were touching the ground at the start of the frame and haven't pressed jump or walked off a cliff, then at the end of the frame move down, again so the distance between you and the floor is -1. done!

BouserTheBun

Glad to have an update on this. I'm curious to see how much different it is from the old method from years by.


More Creators