Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introducing JavaScript Let's Make a Game Doing Things With Functions

How do you determine the coordinates of a game's play screen area?

In Intro to JS, Dave talks about using the screen's coordinates 0,0 to 600 on the y axis and 800 on the x axis to determine where you place the game's coins... however, what's confusing me is what determines the size of the game's play screen? Is this measured in pixels or something else? And most importantly, how do you determine exact locations of objects in your game other than through a bunch of guesswork? There has to be a better/easier way. Thanks for your help!

Akash Sharma
Akash Sharma
Full Stack JavaScript Techdegree Student 14,147 Points

yes from phaser they are stored when you instantiate the

    game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render 

They are in pixels.

I believe to retrieve the values it is game.height or something like game.height and game.width