Chap 7: page 159: Cat Nap: Vertical Wooden Blocks Move

In the game scene, two vertical wooden blocks are positioned. One of the wooden blocks, located at x = 1024, is positioned to be directly underneath the cat. However, when I run the simulator, this block does not stay at 1024, it moves to the left (approx 900) so it is not directly beneath the cat. Therefore, when removing the horizontal blocks, the cat hits the vertical block and cannot land in the bed. The three other wooden blocks (one vertical and two horizontal) remain in the x/y locations they were given in the scene.

Can anyone explain why this wooden block moves upon simulator start up and how I might be able to stop it from doing so (so this level can be solved)?

Thanks

I’m not sure if you’ve figured it out yet, but my guess is that it has to do with the block collisioning with BedNode, effectively moving the block to the left until both nodes stop touching each other.

Make sure you have the categoryBitMask and the collisionBitMask set up properly in BedNode.swift

physicsBody!.categoryBitMask = PhysicsCategory.Bed
physicsBody!.collisionBitMask = PhysicsCategory.None

hello Jackiedog

Thanks for your reply. I did check BedNode in order to insure that all was set up as you suggested.
Unfortunately, my code was fine…and my problem still remains. I have gotten around the moving
vertical piece of wood by simply shifting the horizontal pieces and the cat to the right which then
aligns the cat directly over the (moved) vertical plank (which is how this level is set up) but this shift
should not happen in the first place.

If you have any other ideas, I thank you in advance for them.

Rob