How do I set gravity zone for platform game?

0 favourites
  • 10 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • Hello,

    is it possible to make a platform game but in a vertical direction instead of horizontal? Example: Platform on the left side of the screen. When player jumps he moves right and falls back to the left side.

    I also experimented with the Physics Behaviour and I couldn't figure out how to set an object as main gravity zone. (So the player isnt falling down when the platform is actually on the left side)

    Thank you

  • Something like this?

    https://dl.dropboxusercontent.com/u/485 ... usted.capx

    Oh re-reading your question this capx might be overkill

    You could just set platform angle of gravity to 180 degrees to make the player walk on the left side..

  • Thank you. Platform Angle of Gravity. Can't believe that I couldnt find this by myself ...

  • I have another issue. Please download this example .capx. Click with your mouse to jump and click with your mouse while in the air to change gravity. Anyway..the problem is that if you double click fast..it somehow moves weirdly. It goes up, down a bit and then up again...instead of just going up..and then more up bc of the gravity change.

    Any idea how to fix this?

    Thank you <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    capx: https://www.dropbox.com/s/suimmqwgqt8kr ... .capx?dl=0

  • It doesn't behave weird at all..

    When the player is jumping it goes up, so when you change the gravity in the middle of jumping it goes up, which is down once the gravity has changed..

    you could change this by adding an action after changing the gravity set the players platform vector y = 0..

    This will make the player will stop and start falling..

    If you don't want the player to stop setting the vectorY to -player.platform.vectorY will work..

    player in your case being sprite2.

  • Thank you for the answer. It helped alot. Somehow it must be possible to deform sprites into such a look:

    Do you know how? I tried to play around with the sine behaviour but it's more like for moving stuff around. Cheers

  • Sorry, but I'm not sure what you mean..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LittleStain

    [quote:13bjqes1]

    If you don't want the player to stop setting the vectorY to -player.platform.vectorY will work..

    player in your case being sprite2.

    This works just fine in the browser but not on phone after exporting to an android app. Do you have any idea why ? The player simply jumps. (I even changed the events so 1 click = change gravity. I took out the jump event)

    Very weird :/

  • If it doesn't work on phone it sure isn't the action that doesn't work..

    Probably your triggered event is wrong..

    What is your event for making the player jump and what is the event for changing the gravity?

  • The weird thing is that it works when I build the app with cocoonJS but it doesnt work when building with XDK.

    The event is simply when touch -> set graviy angle + 180. There is no jumping anymore.

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