How do I create a layout with multiple gravities

0 favourites
  • 7 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi,

    How do i create a layout which has two gravities in the scene. Like, the screen has been spliced into two half. And the top half has a normal gravity, where objects falls down. And the bottom half has reverse gravity where the objects moves towards up.

    Thanks in advance

  • You can create a placeholder Gravity setter object (and set it invisible). This object could be an ordinary Sprite. In Event Sheet, when your player or enemy collides with it, you change "angle of gravity" of your platform behavior.

    If you need more help, just say so.

  • Definitely need help. I am new to construct so do need more help like a demo similar file or step instructions.

    Thanks a lot for asking itself.....

  • Here is the capx: http://www.mediafire.com/download/r5dbckk56xjccb6/gravityExample.capx

    Inside the capx contains these objects:

    The black solid floor/ceiling are the same object.

    The stickman is the player, having Platformer behavior.

    The arrows are just 2 different sprites for Gravity Up and Gravity Down.

    Now, in event sheet:

    When player collides with Gravity Up arrow, he will be flipped and his angle of gravity will be set to -90, causing him to have reverse gravity. The same applies for the Gravity Down, but it sets him back to original gravity.

    Angle of Gravity is one of the attributes in events of Platformer behavior. Only objects with Platformer behavior will have this Angle of Gravity listed.

    Try run the capx.

    Are you ok now?

  • Hi there,

    I got your demo file and thanx for that. Quite interesting.

    Check this attached rough image.The green is the land (which is for both the top and bottom worlds). The character should able to walk on the green and when it falls down on the right edge, it will go to the bottom world where it flips and walks upside down there.To do this, is that the same procedure to follow. Because you have used a sprite which allows the character to go upside down when reach near.

    How does this works (When a character falls down on the right side (Where the arrows goes), it should fall like it is falling inside the water. Goes bit down comes back up flipped.

    Help and thanx

  • What you want required no more events from my capx.

    From my capx, how about you stretch the "down arrow" to fill the upper half of your screen, and stretch the "up arrow" to fill the lower half?

    Now, place the solid in the middle, and voila, you will have what you want in no time.

    This way, we won't be dealing with line of gravity, and you can specify directly which area should be up or down by placing and stretching these gravity arrows. Additionally, you can turn these arrows invisible for aesthetics purpose.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks a lot.

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