Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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