0
\$\begingroup\$

My character moves right and left correctly,Right & left movement Right & left movementI want to know if it is possible to move character forward and backward to collect hearts idle (I know that in 2d no z axis I want to know if it is possible or not? )

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

There are definitley ways of accomplishing this without altering actual position of the character but instead making it appear that way.

For instance : You could try adding animations that show the character walking forward and backward (toward/away from screen) and scale his size to make it look like he is moving in the z axis.

\$\endgroup\$
4
  • \$\begingroup\$ scaling his size to make it look like he is moving in the z axis during forward and backward only? @Gav \$\endgroup\$
    – Sh.Adel
    Dec 3, 2018 at 11:37
  • \$\begingroup\$ Yup, let me know if it works for you \$\endgroup\$
    – Gav
    Dec 3, 2018 at 21:26
  • \$\begingroup\$ I made animations (moving forward and backward) and tried to scale it on script if player clicked up arrow decrease the scale of y play downward animation, and if clicked down arrow increase the scale of y and play forward animation .but my problem now detecting collision (normal size of player's collider detect collision of near and far hearts without needing to move forward and backward) \$\endgroup\$
    – Sh.Adel
    Dec 4, 2018 at 6:49
  • \$\begingroup\$ I changed position on script like scale and it works. thanks \$\endgroup\$
    – Sh.Adel
    Dec 4, 2018 at 9:03
2
\$\begingroup\$

Giving the illusion that there's a 3rd dimension has always been used on video games. It can be as simple or as complicated as you like, depending how you'd like the final result to look like.

In your case for example, you can move the character up/down using the Y-axis, to simulate that the character moves "back and forth". As long as the character interacts properly with the environment (in your case, picking up hearts when moving on the same plane as them) the illusion will not be noticed.

One example being Streets of Rage, which didn't even have an animation for moving up and down (it was just using the walk left/right one) and it made a very nice illusion. The character interacts perfectly with objects on the same plane as them, forcing the player to simulate this as 3D while they play.

enter image description here

You can of course change the scaling of the character as well, making them smaller as they move upwards, and bigger as they move downwards. This adds complexity, but gives a more realistic effect.

You can always add more complexity to add realism, but at the end of the day, it depends on the style you want your game to have. There is no wrong or right solution.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .