Simple Swipe to Switch Gravity [C3-C2 Platformer]

1
GeorgeZaharia's avatar
GeorgeZaharia
  • 3 Aug, 2018
  • 366 words
  • ~1-2 mins
  • 1,129 visits
  • 1 favourites

Keeping it very short,

lets add a sprite we give it a size of 20 by 20 give it a color and add a different color circle on top right color of the frame image, so we know which way is up and pointing towards right... face like.

we also add the physics behavior on the sprite object, we also rename it "Char".

We also need a platform, so we add a tiledbackround, give it a dark color, add the physics behavior and make it immovable, give it a length of 400-500 pixels and height of 30-60 pixels so it looks like a platform bar, we also rename it "Platform".

Place the sprite right above the platform, so when you test run the project it will fall on the tiledbackground as the Physics behavior does its magic.

Also almost forgot ... we also need to insert the touch plugin.

Upon the event sheet shall we go now!!!! - tried some 7th century English talking... didn't worked that well ... *Blank-Stare*

On the eventsheet, we need 1 global variable, we call it "ty" - and keep the 0 value

we also add 2 more variables, one being "TyEnd" and the other "Direction" - value same as above.

And we add the following Events

Now for the actual flipping of gravity

And the reverse

And that would be it..

For more explanations what each condition does, download the C3p file from here - download and read the inside comments.

If you don't have a C3 license yet, you can open the above project by going to the following link C3-Editor and open the above file up.

Hope you find it useful, and have a good one!

Subscribe

Get emailed when there are new posts!

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!