01 May 2014, 21:34

Adam BYRNE (4 posts)

Sorry to bother you Chris but I have been having trouble with the piece {remove the red cylinder and replace with the apple} I do not know what is wrong with my code?! could you check it for me?! link: [http://is.gd/xzCQC9]

02 May 2014, 16:03

Chris Strom (116 posts)

It’s no bother!

Your code looks perfect except for one line. Line 117 has a minus sign that should not be there. From the earlier section in that chapter named “Create Game Elements”, line 117 should be:

fruit.rotation.x = Math.PI/2;

You had a minus sign before the Math.PI.

That was a tricky one to track down, so I’m not surprised you couldn’t find it. There were no obvious errors in the JavaScript console, so Chapter 2’s help might not seem helpful. Actually, since all of those errors were missing, the problem wasn’t incorrect JavaScript which told me that one or two lines probably were correct JavaScript, but not doing what they were supposed to do. In this case, the minus sign rotated the fruit so that we couldn’t see the picture when we added it.

Hope that helps. Nice work so far :)

  You must be logged in to comment