help with platform behavior

Discussion and feedback on Construct 2

Post » Sat Aug 24, 2013 8:53 pm


Hi guys. I'm taking part in Ludum Dare 27, and I can't get the platform behavior to work right

CAPX


What to replicate: Move to the right with the troll, don't slow down for the hole. 30% of the time, the troll doesn't fall in, even though it's 6 pixels wider than the troll's bounding box

I know it's the built-in collision.. Can anyone suggest a solution?

Ideally, I would like the troll to fit exactly inside the hole, but I can tolerate a 1-2 pixel margin. Not more than that though. Is it possible?

Thank you!christina2013-08-24 21:11:54
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sat Aug 24, 2013 9:19 pm

Yeah I really wish something will be done about this. It was a huge problem in an earlier project of mine. I don't have access to it atm but what you can do is use collision offsets to see if the player is over a gap they should fall into, then move it down a couple pixels. Currently platform objects move right around corners if they are ~2 pixels below them. Most likely due to how they handle slopes.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Sat Aug 24, 2013 9:31 pm

This was my simplest solution.
https://dl.dropboxusercontent.com/u/666516/dummyfortroll.capx

Basically use a dummy object to detect when its over the hole, then stop the player, and let gravity take over.
Image ImageImage
B
171
S
50
G
179
Posts: 8,392
Reputation: 113,478

Post » Sat Aug 24, 2013 11:45 pm

Thanks you both.
Newt, this doesn't work either, the wait function is tied to framerate as well, so it fails.

I tried it before.
I even tried "snapping" the troll to the middle of the hole, but that creates other problems that I can't solve right now.
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sat Aug 24, 2013 11:55 pm

MadFactory nope, doesn't work either. :/ Thank you both
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sun Aug 25, 2013 1:40 am

Try this.

Needs some tweaking but you get the idea. It's best to put the platform behavior in the family instead so you can mess with it via events. (Setting vector X will to 0 will let you move the object down only a pixel or two instead of ~6, to prevent that "jerk")

Also your sprite mask should never use collisions or behaviors; make a separate simple-shape object like a rectangle for that, then set the sprite mask to 0,0 of it every tick.MadFactory2013-08-25 01:41:20
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Sun Aug 25, 2013 1:48 am

Thanks MadFactory. It didn't work. When I publish it, it seems sluggish for a few seconds, and it doesn't bother checking for collisions (or it does, but it's a super-low framerate). I have no idea why, I have a competent system, and the code is SUPER light. Maybe scaling is doing this? Point + scale*2 ? I have no idea.

I will use a separate player sprite, don't worry. For the time being it doesn't work with the rectangle.
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sun Aug 25, 2013 3:54 am

This works well for a single player: trollgap2.capx
It won't really work for multiple trolls moving together which I'm guessing they do based on the name 'trollemmings'.

Maybe this:trollgap3.capx
Falling down the gap is a little jumpy when you have scrollto on the troll.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Sun Aug 25, 2013 10:26 am

Ramones this is an amazing fix for my situation. No, they will move separately, as in lost vikings/the cave.

So that's what this needs, an impenetrable wall that keeps the troll there until it has the decency to fall.

You're a lifesaver. I can't see what you have in trollgap3.capx because you uploaded trollgap2.capx twice.

But wow!


P.S. Mad, is this the solution you had in mind? christina2013-08-25 10:36:52
B
28
S
12
G
4
Posts: 193
Reputation: 4,581

Post » Sun Aug 25, 2013 3:08 pm

Nah, the goal in my .capx is not to use special objects for holes, but merely check for gaps in the floor. Works fine here, even with the player at 10x its normal speed. Using "hole objects" is not very practical in most games but if it works for you then go for it.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 11 guests