Ejemplo n.º 1
0
        public virtual void step(float dt, ACView pactiveview)
        {
            float runspeed = Framework.Runspeed;
            float realdt   = dt / runspeed;

            _pcontroller.update(realdt); /* Do controller update first, when you're fresh from the OnIdle
                                          * call that did the checking of messages as this, too, checks user input. The mouse
                                          * click handling code of cController expects you to do the update right after the
                                          * standard mouse processing of OnIdle, so don't move this call. This call also stores
                                          * the current dt value inside the controller. And don't use the dt = 0.0.*/
            if (_gameover)               //Meaning you haven't pressed ENTER for the first time.
            {
                dt = 0.0f;               /*  Prevents the lurch at startup when I turn _gameover off, also
                                          *   prevents anything from happening in the move or update methods when _gameover. */
            }
            adjustGameParameters();
            _pbiota.feellistener(dt);        /* Critters listen to the _pcontroller data,
                                              * possibly using _cursorpos.  The cCritterArmedPlayer, in particular, will
                                              * look at the _cursorpos if left button is down.  Use the dt to adjust velocity if you have a
                                              * cListenerCursor, */

            _pbiota.move(dt);                /* Critters save current position as _oldposition, use
                                              * their _velocity and _acceleration to compute a new position, possibly wrap or bounce
                                              * this position off the _border and then set the new _position. */
            _pbiota.update(pactiveview, dt); /* Feel any forces acting on the critter, possibly call sniff
                                              * on pview to	check some pixel colors in the world to maybe back off from something
                                              * or  kill something. We don't presently use the dt argument, but could use it for
                                              * shrinking critter radius. */
            if (dt > 0.0f)                   //Prevent constant readjustment when paused
            // pause is not implemented yet -- JC
            {
                collideStep(); //Critter may abruptly change _position and _velocity in here.
            }
            _pbiota.processServiceRequests();
            _pbiota.animate(dt);
        }