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 trialShaun Kelly
5,648 PointsHe hasn't explained about the position in the ground node class???
He hasn't explained about the divide by 2 in the CGPointMake why do we have to but the /2 in and what does it mean ???
ground.position = CGPointMake(size.width/2,size.height/2);
J R
2,037 PointsJ R
2,037 PointsFor what I understand this is because the anchorPoint of the ground has the default value of (0.5, 0.5) so without changing the position as he did, the default position of the ground would be (0,0) in your XY and because the anchorPoint being in the middle, the ground won't appear fully in your screen. Try commenting that line and you will see where the ground appears. Also, if you comment that line above and add this below, it will have the same results as dividing by 2.
What I don't understand is, what is the benefit of doing it the way he did or adding two lines of code more, can someone explain a bit more, Thanks.