Jump to content

Problem - Newbie


TheClansman
 Share

Recommended Posts

Hello!

 

I am newbie to game development and i chose the phaser to learning.

 

My question is how to make the setting the scenary and personage to behave for the top view, as the example image below.

2-2.jpg

 

Only  managed to make the scenario behave horizontally, like the Mario Bros.

 

could help me?

 

Greetings from Brazil! : D

Link to comment
Share on other sites

Hi Clansman and welcome to Phaser.

 

There are two things that contribute to making the horizontal screen scroll and top/down perspective. The first is gravity. By default, sprites that are physics enabled will have gravity turned on, so they will move in such a way that the top part of the screen is the sky and the bottom part is the ground (the way you would want to have it in a 2D screen-scroll game). To disable this, you need to turn off the sprite's gravity:

sprite.enableBody = true;sprite.body.allowGravity = false;

Make sure that the sprite is physics-enabled and has a body before you do that of course. If your sprite is not physics-enabled, there is no need to turn off gravity.

 

The other thing which affects the top/down vs horizontal perspective is the artwork itself. In the screenshot you posted, the artwork is drawn in the isometric or dimetric perspective. This means that the camera is positioned not directly on top of the characters (what would be a full top-down game) but also not directly across from the characters (what would be a 2D screen-scroll perspective). Instead, the camera is somewhere in-between. This is a common perspective in game dev because it allows the viewers to see a large number of angles all at once.

 

So, once you've got gravity disabled, it's just a matter of making sure the artwork is in the correct perspective. That's it! 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...