Ejemplo n.º 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Engine game = new Engine())
     {
         game.Run();
     }
 }
Ejemplo n.º 2
0
 public Switcher(Game gam, Engine game)
     : base(gam)
 {
     timeToGo = -1;
     timer = false;
     this.game=game;
     switching = false;
 }
Ejemplo n.º 3
0
 public Menu(Engine game, Animation enter, Resources R)
 {
     this.game = game;
     cursorState = 0;
     keyboardState = Keyboard.GetState();
     previousState = Keyboard.GetState();
     this.enter = enter;
     Res = R;
 }
Ejemplo n.º 4
0
 public Planner(Game gam, Engine game)
     : base(gam)
 {
     Events=new List<Event>();
     this.game = game;
 }
Ejemplo n.º 5
0
        public void Update(Engine game,   GameTime gameTime)
        {
            if (!game.KeyboardBlocked)
            {
                keyboardState = Keyboard.GetState();
                keyPressed = false;

                if ((keyboardState.IsKeyDown(Space) && (previousState.IsKeyUp(Space))))
                {
                    if ((Player.BulletsShot < Player.MaxShots)&&(Player.Alive))
                    {
                        game.Fire(Player);
                    }
                }

                if (keyboardState.IsKeyDown(Left) && (keyPressed == false))
                {
                    if (Player.Smer != 4)
                    {
                        Player.CalculateSource(3);
                        Player.Effects = SpriteEffects.None;
                    }

                    Player.Smer = 4;

                    if (!previousState.IsKeyDown(Left))
                    {
                        zvysok = (int)Player.PositionY % game.Constants.BrickSize;
                        Player.PositionY = (int)((int)Player.PositionY / game.Constants.BrickSize);
                        Player.PositionY = (int)Player.PositionY * game.Constants.BrickSize;

                        if (zvysok > game.Constants.BrickSize / 2)
                        {
                            Player.PositionY = Player.PositionY + game.Constants.BrickSize;
                        }
                    }
                    keyPressed = true;
                }
                if (keyboardState.IsKeyDown(Right) && (keyPressed == false))
                {
                    if (Player.Smer != 2)
                    {
                        Player.CalculateSource(3);
                        Player.Effects = SpriteEffects.FlipHorizontally;
                    }

                    Player.Smer = 2;

                    if (!previousState.IsKeyDown(Right))
                    {
                        zvysok = (int)Player.PositionY % game.Constants.BrickSize;
                        Player.PositionY = (int)((int)Player.PositionY / game.Constants.BrickSize);
                        Player.PositionY = (int)Player.PositionY * game.Constants.BrickSize;

                        if (zvysok > game.Constants.BrickSize / 2)
                        {
                            Player.PositionY = Player.PositionY + game.Constants.BrickSize;
                        }
                    }
                    keyPressed = true;
                }
                if (keyboardState.IsKeyDown(Down) && (keyPressed == false))
                {
                    if (Player.Smer != 3)
                    {
                        Player.CalculateSource(1);
                        Player.Effects = SpriteEffects.FlipVertically;
                    }

                    Player.Smer = 3;

                    if ((!previousState.IsKeyDown(Down)) || ((previousState.IsKeyDown(Right) && (previousState.IsKeyDown(Down))))
                        || ((previousState.IsKeyDown(Left) && (previousState.IsKeyDown(Down)))))
                    {
                        zvysok = (int)Player.PositionX % game.Constants.BrickSize;
                        Player.PositionX = (int)((int)Player.PositionX / game.Constants.BrickSize);
                        Player.PositionX = (int)Player.PositionX * game.Constants.BrickSize;

                        if (zvysok > game.Constants.BrickSize / 2)
                        {
                            Player.PositionX = Player.PositionX + game.Constants.BrickSize;
                        }
                    }
                    keyPressed = true;
                }
                if (keyboardState.IsKeyDown(Up) && (keyPressed == false))
                {
                    if (Player.Smer != 1)
                    {
                        Player.CalculateSource(1);
                        Player.Effects = SpriteEffects.None;
                    }

                    Player.Smer = 1;

                    zvysok = (int)Player.PositionX % game.Constants.BrickSize;
                    Player.PositionX = (int)((int)Player.PositionX / game.Constants.BrickSize);
                    Player.PositionX = (int)Player.PositionX * game.Constants.BrickSize;

                    if (zvysok > game.Constants.BrickSize / 2)
                    {
                        Player.PositionX = Player.PositionX + game.Constants.BrickSize;
                    }

                    keyPressed = true;
                }

                previousState = keyboardState;

            }
        }