// This is called after the Box2D world has been loaded, and while the b2dJson information
        // is still available to do extra loading. Here is where we obtain the named items in the scene.
        public override void AfterLoadProcessing(Nb2dJson json)
        {
            // call superclass method to load images etc
            base.AfterLoadProcessing(json);

            // preload the sound effects
            //SimpleAudioEngine::sharedEngine()->preloadEffect("jump.wav");
            //SimpleAudioEngine::sharedEngine()->preloadEffect("pickupgem.wav");
            //SimpleAudioEngine::sharedEngine()->preloadEffect("pickupstar.wav");

            // find player body and foot sensor fixture
            m_playerBody = json.GetBodyByName("player");
            m_footSensorFixture = json.GetFixtureByName("footsensor");

            // find all fixtures in the scene named 'pickup' and loop over them
            List<b2Fixture> pickupFixtures;
            pickupFixtures = json.GetFixturesByName("pickup").ToList();

            foreach (var f in pickupFixtures)
            {
                //For every pickup fixture, we create a FixtureUserData to set in
                //the user data.
                PlanetCuteFixtureUserData fud = new PlanetCuteFixtureUserData();
                m_allPickups.Add(fud);
                f.UserData = fud;

                // set some basic properties of the FixtureUserData
                fud.fixtureType = _fixtureType.FT_PICKUP;
                fud.body = f.Body;
                fud.originalPosition = f.Body.Position;

                // use the custom properties given to the fixture in the RUBE scene
                //fud.pickupType = (_pickupType)json.GetCustomInt(f, "pickuptype", PT_GEM);
                //json.Equals
                //fud.bounceSpeedH = json.GetCustomFloat(f, "horizontalbouncespeed");
                //fud.bounceSpeedV = json.GetCustomFloat(f, "verticalbouncespeed");
                //fud.bounceWidth  = json.GetCustomFloat(f, "bouncewidth");
                //fud.bounceHeight = json.GetCustomFloat(f, "bounceheight");

                //these "bounce deltas" are just a number given to sin when wobbling
                //the pickups. Each pickup has its own value to stop them from looking
                //like they are moving in unison.
                fud.bounceDeltaH = CCRandom.Float_0_1() * (float)Math.PI;
                fud.bounceDeltaV = CCRandom.Float_0_1() * (float)Math.PI;
            }

            // find the imageInfos for the text instruction images. Sprites 2 and 3 are
            // hidden initially
            m_instructionsSprite1 = null;
            m_instructionsSprite2 = null;
            m_instructionsSprite2 = null;

            foreach (var imgInfo in m_imageInfos)
            {
                if (imgInfo.Name == "instructions1")
                    m_instructionsSprite1 = imgInfo;
                if (imgInfo.Name == "instructions2")
                {
                    m_instructionsSprite2 = imgInfo;
                    m_instructionsSprite2.Sprite.Opacity = 0; // hide
                }
                if (imgInfo.Name == "instructions3")
                {
                    m_instructionsSprite3 = imgInfo;
                    m_instructionsSprite3.Sprite.Opacity = 0; // hide
                }
            }

            // Create a contact listener and let the Box2D world know about it.
            m_contactListener = new PlanetCuteContactListener();
            m_world.SetContactListener(m_contactListener);

            // Give the listener a reference to this class, to use in the callback
            m_contactListener.m_layer = this;

            // set the movement control touches to nil initially
            //m_leftTouch = null;
            //m_rightTouch = null;

            // initialize the values for ground detection
            m_numFootContacts = 0;
            m_jumpTimeout = 0;

            // camera will start at body position
            m_cameraCenter = m_playerBody.Position;
        }