Weight scale-style platform

0 favourites
  • 6 posts
From the Asset Store
Pack of illustrator graphic styles. Make your own logos, game titles, or anything you want.
  • I'm trying to implement a weight scale-style platform in my game where when enough "weight" is on the platform it will go down, otherwise it will go back up. I'm not looking to mix physics behavior (or realistic life-like physics) in this project so I'd preferably like to find a way to set this up differently. To be more clear, what I want is just a platform that will go down if 3 boxes or player and 2 boxes are over the platform. I would need it to also work in cases when boxes are piled up over one another on the platform or when player is standing on a box that is on the platform, as long as the needed "weight" to move the platform is reached.

    I have a hard time figuring out the event logic to make this happen. I've tried using hitbox and instances to add/substract from the weight but can't get it to work as I'd like. I'm not sure what would be the best way to get the platform to react also in case the weight is piled up over one another and not standing directly on the platform. Is this even practical to try without physics or is it just better to try and go with physics instead? I've had some problems with mixing physics and platforming behaviors in the past so I'm hesitant to use it unless I have no choice.

    Anyone have any advice on how this could be implemented? I'm a bit stuck at the moment and thankful for any possible help!

  • It certainly can be done without physics. I would probably use a "detector" sprite - an invisible sprite above (and pinned) to the scale platform. When enough boxes and/or the player are colliding with it, then lower it.

  • Exactly like AllanR said: You could make an invisible trigger box on the "scale" and when three boxes is overlapping the trigger on the scale it goes up/down.

  • Thanks for the quick reply! That's how I've tried to do it, I have a triggerbox1 pinned to the lift platform to count the objects overlapping it (to add as weight) and triggerbox2 to the side to prevent the objects interlapping only barely with the lift and still counting towards the weight.

    This is working so far as it should, counter adds the weight when objects overlap with triggerbox1 only and substracts weight when not, but problems arise if there's an object next to the lift and other objects are stacked over it, as demonstrated by this mockup picture:

    As the upper objects are overlapping with triggerbox1 only, they still add to the weight counter, even when in reality their weight is not on the lift platform at all. I probably need an instance value for boxes to state whether they're standing on the lift or not or something. Not sure yet how to approach it, but if any suggestions come to mind as to how to fix this I would be very happy to hear about them:)

  • Waltuo

    I would create a family for stuff that can go on the scale (boxes and player) and add an instance variable called something like ExcludeFromScale (and possibly one called Weight if you wanted different size boxes or other items and need a specific weight to lower the platform). Anything overlapping the Prevent box would get flagged as ExcludeFromScale, and anything resting on top of an excluded object would then also get marked as excluded.

    So, to test objects overlapping the allow area (and not already excluded by overlapping the prevent area), I would do a For Each (oredered) scalefamily order by scalefamily.Y descending (that would start at the bottom and work to the top) and test to see if the object they are on is excluded.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you finally implement a weight scale style platform in your game?

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