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! While you're at it, check out some resources Treehouse students have shared here.

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 Finishing the Game Control the Flow with Conditional Statements

Manuel Cano
Manuel Cano
1,058 Points

key property part of item

at 3:46, you mentioned about key being a property of item. Is key part of the phaser.js framework? when and where is key called/stored and how does it detect what you're referring to?

1 Answer

Steven Parker
Steven Parker
229,608 Points

Since the "key" is a property of a Phaser.Sprite object, it is stored in each item instance. It gets set from the third argument of the "create" method. This basic object type is part of the Phaser framework.

You must already have a reference to an object in a variable to be able to access the key. The contents of the key is just the name of the object type (star, coin, etc).

Manuel Cano
Manuel Cano
1,058 Points

perfect response. Thank you.