How do I set gravity zone for platform game?

Get help using Construct 2

Post » Fri May 29, 2015 4:15 pm

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
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Fri May 29, 2015 4:24 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 29, 2015 4:39 pm

Thank you. Platform Angle of Gravity. Can't believe that I couldnt find this by myself ...
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Fri May 29, 2015 5:28 pm

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 :)

capx: https://www.dropbox.com/s/suimmqwgqt8kr ... .capx?dl=0
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Fri May 29, 2015 5:57 pm

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 29, 2015 8:39 pm

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

Do you know how? I tried to play around with the sine behaviour but it's more like for moving stuff around. Cheers
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Fri May 29, 2015 8:53 pm

Sorry, but I'm not sure what you mean..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat May 30, 2015 11:20 am

@LittleStain

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 :/
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Sat May 30, 2015 2:08 pm

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat May 30, 2015 2:56 pm

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.
B
12
S
3
Posts: 211
Reputation: 1,477


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 12 guests