help with platform behavior

0 favourites
  • 10 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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!

  • 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.

  • This was my simplest solution.

    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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • MadFactory nope, doesn't work either. :/ Thank you both

  • 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.

  • 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.

  • 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.

  • 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?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)