small medium large xlarge

27 Apr 2014, 18:44
Adam BYRNE (4 posts)

Hi, i have been having trouble with the purple fruit monster chapter. {it says that i should not have the purple box moving} but it was moving, straight up in fact could you please check the code?! link = (

01 May 2014, 17:24
Chris Strom (250 posts)


Sorry for the delay in replying. I’ve been travelling a bit and having a hard time getting Internet access. I usually try to be much quicker.

If I had to guess, I would say that you created this code from the “3D starter project (with Physics)” project template instead of the “3D starter project” template that 15.1 Getting Started asked for.

That would definitely save some typing in this chapter, but it’s good to type that stuff at least once, which is why the chapter was setup that way. Why is it good? Well, you’ll think about what each of those pieces does at least once. You may not remember next month what each does, but having gone through it, you’ll have it in the back of your brain which turns out to be really helpful at times when you least expect it. Also, it’s nice to be able to say, “I typed it all out once and I am sure glad I never have to again!” It’s exactly like old people telling you how they walked through snow to get to school except you get to say it :)

Anyhow, I think it’ll be OK to keep going, but no guarantees since we only tested to make sure that it worked following along. If you have problems, look at the back of the book to see the completed code.

Also, you have a bug on line 58. You need two ones so that it looks like:

    avatar.setLinearFactor(new THREE.Vector3(1,1,0));

It’s pretty weird what happens if you leave it at (0, 0, 0) so maybe leave it and watch your player slowly move in strange directions. But (1,1,0) is definitely the right way to code a player in a 2d game like this.

01 May 2014, 19:59
Adam BYRNE (4 posts)

Thank you very much Chris! I will try that out now!


You must be logged in to comment