I need help! I can't find a good solution to slopes in the new Platform School tutorials. I've been racking my brain for two days on this now. The platform behavior itself navigates up and down slopes just fine. That's not the problem. The issue I'm having is lining the player up with the slopes.
In the old tutorials, the player and the hitbox were separate objects. That means that if the hitbox detected a slope, then the player sprite could set it's angle, and be moved downward a few pixels from the hitbox, in order to line itself up with the slope.
Here's the problem: In the new tutorials, I've gotten rid of the separate hitbox and I'm using David's new collision mask feature instead. So... setting the angle of the sprite now also sets the angle of the hitbox, which I have found to be rather glitchy.
Also, I am using the "Auto Rotate" and "Auto Mirror" features so that the player sprite only needs one animation angle. Setting the angle manually seems to work well enough, but if you're not actively setting the angle then the Auto Rotate feature kicks in and makes the player face where it thinks he should be facing. It's not a bug, since it's working like it's supposed to, it's just an inconvenience.
So, here's where the challenge comes in. I may just be going about this the wrong way, and someone out there might have a better solution. I'm inviting people to help make the player line up with slopes. Here's the .cap:
The solution you create has to fit in with the rest of the tutorials, so there are a few rules. They are as follows:
- You must use the Charlie sprite as-is. You cannot add angles or change the Charlie sprite, it's hotspots, or it's collision mask. You may add image points if need be.
- You must use the Auto Rotate and Auto Mirror features.
- You cannot use any behavior on Charlie other than Platform.
- I would rather you not use a separate "detector" object. If it's completely necessary to your solution, then that's okay.
- You may add any families, variables, or attributes that you need. The slope objects already have a custom "Slope" attribute assigned to them.
- Your solution must be simple enough for a newbie to understand. You can use complicated math as long as you are able to explain it to a layman. (In other words, if I don't understand it then it's too complicated )
You can use any method you see fit to make running up and down the slopes look natural. I will pick the easiest and best looking solution and incorporate it into the tutorial, where you will get credit.
With the guidelines I've set it might not actually be possible to do what I'm asking. All I know is that what I've tried hasn't worked. Hopefully someone can find a way, but if not then that's okay... I just won't have slopes in the new Platform School tuts.
And thanks in advance for the help