Invert Gravity Platformer

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Sep 03, 2011 9:06 am

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:
[code]acts.SetGravity = function (grav) {
     this.g = grav;
     if (this.g < 0)
          this.g = 0;
};[/code]
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.brockatkinson2011-09-03 09:13:40
B
14
S
1
G
2
Posts: 85
Reputation: 2,810

Post » Sat Sep 03, 2011 10:11 am

Um, the platform behaviour has a "Set gravity direction" action that lets you set the gravity wherever you please?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sat Sep 03, 2011 10:45 am

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 :)
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,843
Reputation: 48,287

Post » Sun Sep 04, 2011 10:20 am

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

It doesn't have "set gravity direction".brockatkinson2011-09-04 10:20:36
B
14
S
1
G
2
Posts: 85
Reputation: 2,810

Post » Sun Sep 04, 2011 10:48 am

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,843
Reputation: 48,287


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests