playMaker

Author Topic: Changing layers in top-down 2d  (Read 816 times)

Seiryu33

  • Full Member
  • ***
  • Posts: 133
Changing layers in top-down 2d
« on: May 19, 2021, 04:01:31 AM »
So this is one i've been trying to find information on. Specifically, for a top-down game, how would I program characters to jump from layer to layer? Like if the player character is on a ground layer and an enemy jumps down from above, how would I set that up?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Changing layers in top-down 2d
« Reply #1 on: May 19, 2021, 07:53:35 AM »
Hi.
which part you have difficulties with?
Detecting player
Jump down?

to detect you can do for example a box cast(2D) (Ecosystem)

To jump down you could disable the collider for a moment to pass thru the floor.

Seiryu33

  • Full Member
  • ***
  • Posts: 133
Re: Changing layers in top-down 2d
« Reply #2 on: May 19, 2021, 06:58:43 PM »
Like in Phantom Hourglass/Spirit Tracks where you can move from layer to layer: I.e, walking down staircases, being boosted up to another layer by wind gusts, etc. Like if I wanted to boost a character onto a layer above them.
« Last Edit: May 19, 2021, 07:01:22 PM by Seiryu33 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Changing layers in top-down 2d
« Reply #3 on: May 20, 2021, 05:43:31 AM »
Boost up you could use 'Add Force' or animate it with a Tween action

for stair cases use a flat surface as collider and rotate it to the degree your staircase is.

Seiryu33

  • Full Member
  • ***
  • Posts: 133
Re: Changing layers in top-down 2d
« Reply #4 on: May 20, 2021, 06:57:53 PM »
To kind of expand on the topic, how would I make characters fall down holes? For top-down games, you would have to set gravity to 0, but would still be the same basic issue of changing layers.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Changing layers in top-down 2d
« Reply #5 on: May 20, 2021, 07:05:23 PM »
Hi.
Why would you need to set the gravity to 0?

you can rotate the camera to make it look topdown.

Also you can set gravity to a certain direction. (i believe somewhere in the project settings)

both can work