Пример #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="player"></param>
 public IdleState(Player player)
 {
     Player = player;
     Player.Sprite.PlayAnimation("idle");
     //Player.Velocity = new Vector2(0, GV.GRAVITY);
     Player.MaxLightRadius = 0;
     Player.Rate = 0;
 }
Пример #2
0
 public Attack1State(Player player)
 {
     Player = player;
     Player.Sprite.PlayAnimation("attack");
     Player.Velocity = new Vector2(0, Player.Velocity.Y);
     Player.MaxLightRadius = 0;
     Player.Rate = 0;
 }
Пример #3
0
 public HittingState(Player player)
 {
     this.Player = player;
     this.Player.Sprite.PlayAnimation("hitting");
     if (Player.Direction == "left")
         Player.Velocity = new Vector2(5,0);
     else if (Player.Direction == "right")
         Player.Velocity = new Vector2(-5,0);
 }
Пример #4
0
 public JumpingState(Player player)
 {
     Player = player;
     Player.Sprite.PlayAnimation("jumping");
     //Player.Velocity = new Vector2(Player.Velocity.X, -(Math.Abs(Player.AnalogState)) +JUMPVELOCITY);
     Player.Velocity = new Vector2(Player.Velocity.X, JUMPVELOCITY);
     Player.IsOnGround = false;
     Player.MaxLightRadius = 0;
     Player.Rate = 0;
 }
Пример #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            GV.ContentManager = Content;
            TDManager.Initialize();
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // Old loading method
            level = Content.Load<Level>("Levels/Level_01");
            // New loading method
            //level = Level.Load("../../../../Kismet Content/Levels/Level01_A.xml");
            level.Initialise(Content);

            GV.Level = level;
            GV.SpriteBatch = spriteBatch;

            GV.LEFT = "left";
            GV.RIGHT = "right";
            GV.GRAVITY = 1.0f;
            GV.ShowBoxes = true;

            player = new Player("XML Documents/DanAnimations", GV.Level.PlayerStartingPosition);

            GV.Player = player;

            Camera.WorldRectangle = new Rectangle(0, 0, GV.Level.Width, GV.Level.Height);
            Camera.Position = new Vector2(0, 0);
            Camera.ViewPortWidth = 1280;
            Camera.ViewPortHeight = 720;

            GV.EDITING = false;
        }
Пример #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            level01 = Content.Load<Level>("Levels/Level_01");
            level01.Initialise(Content);
            player = new Player(this.Content, "XML Documents/DanAnimations", level01);
            goblin = new Enemy(this.Content, "XML Documents/GoblinAnimations", level01);
            goblin1 = new Enemy(this.Content, "XML Documents/GoblinAnimations", level01);
            goblin2 = new Enemy(this.Content, "XML Documents/GoblinAnimations", level01);
            player.Position = new Vector2(0.0f, 420.0f);

            goblin.Position = new Vector2(500.0f, 420.0f);
            goblin1.Position = new Vector2(1000.0f, 420.0f);
            goblin2.Position = new Vector2(200.0f, 420.0f);
            // TODO: use this.Content to load your game content here
        }
Пример #7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;

            //graphics.GraphicsDevice.SetRenderTarget(new RenderTarget2D(graphics.GraphicsDevice, 1280, 720));

            //ResourceManager.Instance.Texture("Tiles", Content.Load<Texture2D>(System.IO.Path.Combine(@"Tiles\", "Tiles")));
            GV.ContentManager = Content;
            TDManager.Initialize();
            //level01 = Level.Load("../../../../Level EditorContent/Levels/Level01_A.xml");
            level01 = Content.Load<Level>("Levels/Level_01");
            level01.Initialise(Content);

            GV.Level = level01;
            GV.SpriteBatch = spriteBatch;

            GV.LEFT = "left";
            GV.RIGHT = "right";
            GV.GRAVITY = 1.0f;
            GV.ShowBoxes = true;

            player1 = new Player("XML Documents/DanAnimations", level01.PlayerStartingPosition);

            GV.Player = player1;

            // Setup the camera
            Camera.WorldRectangle = new Rectangle(0, 0, GV.Level.Width, GV.Level.Height);
            Camera.Position = new Vector2(0, 0);
            Camera.ViewPortWidth = pictureBox.Width;
            Camera.ViewPortHeight = pictureBox.Height;

            lastMouseState = Mouse.GetState();
            pictureBox_SizeChanged(null, null);

            GV.EDITING = true;
            followPlayer = false;
        }
Пример #8
0
 public MagicAttackState(Player player)
 {
     Player = player;
     Player.Sprite.PlayAnimation("magicAttack");
     Player.Velocity = new Vector2(0, 0);
 }
Пример #9
0
 public LightState(Player player)
 {
     Player = player;
     //Player.Velocity = new Vector2(0, 0);
 }
Пример #10
0
 /// <summary>
 /// Initialises the singleton's values
 /// </summary>
 /// <param name="currentPlayer">The player object</param>
 /// <param name="currentLevel">The level currently being used</param>
 public void Initialise(Player currentPlayer, Level currentLevel)
 {
     textures = new Dictionary<string, Texture2D>();
     levels = new Dictionary<string, Level>();
     player = currentPlayer;
     level = currentLevel;
 }
Пример #11
0
 public JumpingAttackState(Player player)
 {
     this.Player = player;
     this.Player.Sprite.PlayAnimation("jumpingAttack");
 }