The "Help me with Platform School" Challenge

Post your own tutorials, guides and demos.

Post » Thu Feb 11, 2010 10:53 pm

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:

http://dl.dropbox.com/u/529356/slopetest.cap
v0.99.82

The solution you create has to fit in with the rest of the tutorials, so there are a few rules. They are as follows:
[list:119mat90]
[*:119mat90]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.[/*:m:119mat90]
[*:119mat90]You must use the Auto Rotate and Auto Mirror features.[/*:m:119mat90]
[*:119mat90]You cannot use any behavior on Charlie other than Platform.[/*:m:119mat90]
[*:119mat90]I would rather you not use a separate "detector" object. If it's completely necessary to your solution, then that's okay.[/*:m:119mat90]
[*:119mat90]You may add any families, variables, or attributes that you need. The slope objects already have a custom "Slope" attribute assigned to them.[/*:m:119mat90]
[*:119mat90]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 :P)[/*:m:119mat90][/list:u:119mat90]

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 :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Feb 12, 2010 10:35 am

I would just use a separate detector sprite. While using the custom collision mask may be convenient, for this type of problem, you're making the problem far harder. If you're trying to find an angle and the act of testing an angle changes the collision mask, you're already in an order of magnitude harder problem than using a separate hitbox.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Feb 12, 2010 11:56 am

[quote="Ashley":8ofpjxq9]I would just use a separate detector sprite. While using the custom collision mask may be convenient, for this type of problem, you're making the problem far harder. If you're trying to find an angle and the act of testing an angle changes the collision mask, you're already in an order of magnitude harder problem than using a separate hitbox.[/quote:8ofpjxq9]

Yeah, I'm realizing that a bit too late. The thing is, I've already finished the first few lessons and they're all using the collision masks. It was a bit of poor planning on my part. Live and learn, I guess.

The reason I switched to the collision masks is because I wanted to show the new feature, and I wanted to make the tutorial as compact and efficient as possible. Using separate hitboxes means extra objects and extra events. I guess missing out on slopes is the trade-off. So I think the best thing to do is just leave slopes out of the main tutorial, and maybe have a separate mini-lesson that shows how to do it the old way. It's not really necessary to have them in the tut anyway, this is Platform School after all, not Slope Academy or Hill College or something.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Feb 12, 2010 4:53 pm

Would it be very hard to add the ability to at least get some information from the collision mask during runtime?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Feb 12, 2010 7:16 pm

Information like what? I'm not sure what you mean.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Feb 14, 2010 5:53 am

I kind of got something to look right, but it is more for hills rather than ramps...
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Tue Feb 23, 2010 8:10 pm

I don't think you'd even need to rotate the player for slopes. I think the normal method is to simply have the player sprite overlapping the slope slightly without changing angle. It is simple and effective.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Tue Mar 09, 2010 2:27 pm

Hi there,

I'm a brand new follower of the Construct pilgrimage so bare with me if I make stupid suggestions ;)
Is it possible to detect a collision of an image point of a sprite? If so wouldn't it be possible to place two image points on the left and right bottom of the sprite and then calculate the needed angle the sprite has to rotate in order not to colide with one of theese points and the slope? I think then the smooth ramping mentioned in another thread would also be possible to achieve.

Looking forward to learn and create here!
B
2
G
2
Posts: 22
Reputation: 694

Post » Wed Mar 10, 2010 3:26 pm

[quote="olipool":24pgl147]Is it possible to detect a collision of an image point of a sprite? If so wouldn't it be possible to place two image points on the left and right bottom of the sprite and then ... rotate ...?[/quote:24pgl147]

Yes it is possible, but the hotspots rotate with the sprite so it's not as easy as you might think :). I tried this solution and didn't have much luck with it. While it is possible to get a smoothly rotating player, it goes from "simple" to "difficult" rather quickly, and since this is a beginner's tutorial it wouldn't really fit in there.

Anyway, I'm afraid the slopes were left out of the lesson in question, and they won't be returning. Sorry, but that's just how it's going to be.

Closing the thread because it's really not needed any more, but thanks to everyone who tried helping out :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests