playMaker

Author Topic: 2D Physics Based Platformer Tutorial  (Read 53450 times)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #90 on: December 07, 2014, 05:17:45 PM »
Well you can change its mass when jumping, and upon landing, change the value back to normal, I think that'll do.

By just setting Get Property, and adding another one at the first state?

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #91 on: December 07, 2014, 09:22:42 PM »
You can try that, and see if its working or not...

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #92 on: December 08, 2014, 03:58:10 PM »
How do I set up a boxed trigger to make the player respond back from a previous platform? I'm almost done with stage, but I want to have the player respawn so when they die, they don't have to refresh the web page allover again.
« Last Edit: December 09, 2014, 06:48:34 PM by coffeeANDsoda »

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #93 on: December 20, 2014, 01:35:34 AM »
Just FYI, this is what I currently have for the project for the raycast kill player issue. No matter what I do for this, I can't seem to get a death and respawn mechanic to work.

https://db.tt/nr0KdLsA

https://db.tt/gIHcYFh8

https://db.tt/3lj0JD8J

https://db.tt/4p88eNLd

https://db.tt/74mXlgrb

https://db.tt/GBgubjos

https://db.tt/PluYBZYQ

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #94 on: December 20, 2014, 06:41:14 PM »
You can use triggers for this, position each triggers on each of the edge of the platforms, and when it gets triggered by the player, save its position to a vector3 variable, and if the player falls, set the player position back to that saved vector3 variable..

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #95 on: December 20, 2014, 06:53:07 PM »
You can use triggers for this, position each triggers on each of the edge of the platforms, and when it gets triggered by the player, save its position to a vector3 variable, and if the player falls, set the player position back to that saved vector3 variable..

And if I set up respawn triggers on each platform or on some, would that vector3 variable be local or global? Plus what would that mean for the players death on the bottom dark colored trigger.

This is what I don't get, what actions would be needed like for after the trap destroys the player? Can't it be setting the position even for one single respawn?
« Last Edit: December 20, 2014, 11:31:10 PM by coffeeANDsoda »

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #96 on: December 22, 2014, 07:48:06 PM »
It would be easier to use global variable for the vector3, though I'd recommend use the local one, and send that variable between object.

Don't destroy the player, just set its position back to the last vector3 stored when the player triggers the last trigger are before he falls.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #97 on: December 23, 2014, 12:48:36 AM »
It would be easier to use global variable for the vector3, though I'd recommend use the local one, and send that variable between object.

Don't destroy the player, just set its position back to the last vector3 stored when the player triggers the last trigger are before he falls.

Well destroying the player, that when it's act really weird on my end, like the players main camera is upside down. So even if I use a local vector3 variable, how could the triggers tell where the players position could go, whether it's the first respawn, second, third, and so on?

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #98 on: December 23, 2014, 03:29:52 AM »
Well that is why the player should not be destroyed, instead reposition it using the vector 3 value, and it is not the trigger who telling the player where it should respawn, but every time the player triggered the trigger object, store that trigger object position, and if the player falls, then reposition the player to that variable. The player will respawn exactly in the trigger position (the last trigger object the player triggered/encountered).

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #99 on: December 24, 2014, 01:57:35 PM »
And this applies for one whole object that triggers death right?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #100 on: December 24, 2014, 09:19:00 PM »
Well this is what I have right now for it.

https://db.tt/B22u2o6m

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #101 on: December 26, 2014, 06:07:38 AM »
You should create separate trigger object each on the edge of the ground, and give it an action which store its position to a vector3 variable everytime a player trigger enter it. And use that variable to re position the player when it falls..

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #102 on: December 26, 2014, 01:40:13 PM »
You should create separate trigger object each on the edge of the ground, and give it an action which store its position to a vector3 variable everytime a player trigger enter it. And use that variable to re position the player when it falls..

Therefore by using a vector3 variable it only works if it's a global?

By the way, as in the URL I posted above, do you notice that when the player collides with a wall it sticks instead of slips off of a object or wall?

How can this be fixed?

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #103 on: December 26, 2014, 07:27:19 PM »
vector3 variable can be global or local, but with local you'll have get or set the variable to transfer its value between FSM, as with global it will be easier, because you can use it right away between FSM, without the need for get or set variable actions.

For stucking issue, just simply create a physics material, and set its friction to 0 (both static and dynamic friction), and apply that material to the player collider component.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #104 on: December 27, 2014, 06:20:07 PM »
For sticking issue, just simply create a physics material, and set its friction to 0 (both static and dynamic friction), and apply that material to the player collider component.

How come when I apply the material on the object it doesn't effect the player until I add the same one?