Exemplo n.º 1
0
        //----------------------------------------------------------------------------------------------

        //--------------------------HANDLE TIMERS--------------------------
        private void initializeTimer(Entity e)
        {
            SmushComponent smushComp = ( SmushComponent )e.getComponent(GlobalVars.SMUSH_COMPONENT_NAME);

            startUpperWait(e);
            smushComp.setHasInitializedTimer(true);
        }
Exemplo n.º 2
0
        //You must have this, but it may be empty.
        //What should the entity do in order to revert to its starting state?
        //Common things are:
        //Set position back to startingX and startingY
        //NOTE: If doing this, you probably want to use the MovementSystem's teleportToNoCollisionCheck() method
        //rather than the usual changePosition()
        //Set velocity to 0 in both directions
        //Note: Some things, like ground, dont move, and really don't need anything here.
        //Note: Some things, like a bullet, won't ever exist at the start of a level, so you could probably leave this empty.
        public override void revertToStartingState()
        {
            PositionComponent posComp = (PositionComponent)this.getComponent(GlobalVars.POSITION_COMPONENT_NAME);

            level.getMovementSystem().changePosition(posComp, posComp.startingX, posComp.startingY, false, false);

            TimerComponent timeComp = ( TimerComponent )this.getComponent(GlobalVars.TIMER_COMPONENT_NAME);

            timeComp.clearAllTimers();

            SmushComponent smushComp = ( SmushComponent )this.getComponent(GlobalVars.SMUSH_COMPONENT_NAME);

            smushComp.setHasInitializedTimer(false);
        }