Invert Gravity Platformer

This forum is currently in read-only mode.
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Hi.

    What I essentially want is a platformer plugin, which can invert its own gravity and go on the roof. Sounds simple enough.

    I edited the platformer plugin, and there was the snippet:

    acts.SetGravity = function (grav) {
         this.g = grav;
         if (this.g < 0)
              this.g = 0;
    };

    So I simply removed the if() case, and was able to set my character's gravity to -1500 and it worked perfectly; he 'fell' onto the roof, just like I assumed he would.

    I want to have it able to be changed in the game, and I've set up keys to change the gravity (from 1500 to -1500). However, every time I go to change his gravity value in an event, it initializes it back to zero for some reason.

    Is there some type of fallback in the event code which does this?

    tl;dr the event manager, for some reason, won't let me change a behaviour plugin to negative, even though the plugin has been altered to allow for that.

  • Um, the platform behaviour has a "Set gravity direction" action that lets you set the gravity wherever you please?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just did a quick test, and as Somebody has said, you can access the gravity direction from events, so can set the direction to up,down, left or right easily. Is this not good enough for your purpose?

    Actually, never thought of using this before, but it has given me ideas also :)

  • Sorry. I'm using Construct 2, which I should have mentioned.

    It doesn't have "set gravity direction".

  • You might want to post any questions/suggestions etc in the Construct 2 section. That way, Ashley will see it (I doubt if he checks the rest of the site often as he's busy with Construct2) and hopefully implement it.

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