Ejemplo n.º 1
0
 public void reset()
 {
     frame = 0;
     direction = 0;
     counter = new Counter(10);
     source = SOURCES[0];
 }
Ejemplo n.º 2
0
 internal Animate()
 {
     frame = 0;
     direction = 0;
     counter = new Counter(8);
     source = SOURCES[ACTIVE_SOURCE];
 }
Ejemplo n.º 3
0
        // constructor
        public Enemy(int _type)
            : base(Vector2.Zero)
        {
            type = _type;
            position = new Vector2
            (
                Game1.random.Next(0, (int)Game1.WIDTH),
                Game1.random.Next(0, (int)Game1.HEIGHT)
            );
            speed = new Vector2
            (
                (float)GenerateSpeed(),
                (float)GenerateSpeed()
            );

            alive = true;
            selectMovement();

            moveSwitch = new Counter(Game1.random.Next(5 * Game1.SECOND, 10 * Game1.SECOND));
            counter = new Counter(Game1.random.Next(1 * Game1.SECOND, 3 * Game1.SECOND));
            pause = new Counter(Game1.random.Next(100, 200));

            movement = new List<Action>
            {
                MoveLine,
                MoveDiagonal,
                MoveStaircase,
                MoveWaveX,
                MoveWaveY,
                MovePause,
            };

            imageSet = xset;
        }
Ejemplo n.º 4
0
        public Trail(ref Player player)
        {
            mPlayer = player;
            bound = new Rectangle(0, 0, Entity.SIZE, Entity.SIZE);

            positions = new List<Vector2>();
            sources = new List<Rectangle>();
            directions = new List<int>();

            for (int i = 0; i < SIZE; i++)
            {
                positions.Add(Vector2.Zero);
                sources.Add(player.Ani.source);
                directions.Add(0);
            }

            timer = new Counter(DELAY);
        }
Ejemplo n.º 5
0
        void drawDisplay(Counter timer, int round)
        {
            string []msg = {timer.Name + " " + (timer.Current / Game1.FPS) + " / " + (timer.Limit / Game1.FPS),
                    "Round#: " + (round + 1) + " / " + Game1.NUM_OF_ROUNDS};

            for (int i = 1; i <= 2; i++)
            {
                labels[i].Text = msg[i - 1];
                labels[i].Draw();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            random = new Random();

            actions = new Dictionary<STATE,Action>();
            actions.Add(STATE.MAIN, actionMain);
            actions.Add(STATE.CREDITS, actionCredit);
            actions.Add(STATE.INSTRUCTIONS, actionInstructions);
            actions.Add(STATE.ENDGAME, actionEnd);
            actions.Add(STATE.PAUSED, actionPause);
            actions.Add(STATE.REGULAR, actionNormal);

            //actionCredit, actionInstructions, actionNormal, actionEnd, actionPause, () => { }, };
            state = START_STATE;
            pauseTimer = new Counter(DURATION_OF_PAUSE * FPS, "PAUSED TIME");
            roundTimer = new Counter(TIME_OF_ROUNDS * FPS, "ROUND TIME");
            artist = new Artist();
            startgame = actionInit;
            base.Initialize();
        }