Exemple #1
0
        private Vector2 position; // Holds actor's position

        public CrouchAction(AActor actor)
        {
            _actor = actor;
            _actionStateMachine = actor.actionStateMachine;
        }
Exemple #2
0
        // Set which stage should be played
        public void Entered(params object[] args)
        {
            pixel = new Texture2D(graphics, 1, 1);
            Color[] colourData = new Color[1];
            colourData[0] = Color.Red; //The Colour of the rectangle
            pixel.SetData <Color>(colourData);

            if (args.Length > 0)
            {
                //_currentStage = _stages[args[0].ToString()];
                player        = (Player)args[1];
                _currentStage = new Stage();
                _currentStage.loadContent((int)args[0]);
            }
            else
            {
                player        = new Player();
                _currentStage = new Stage();
                _currentStage.loadContent(1);
            }

            loadCameraSettings();

            Floor = new GameObject(content.Load <Texture2D>("Images/stages/floor"), new Vector2(0, 270));

            timeTextFont  = content.Load <SpriteFont>("Font/StageName");
            fader         = content.Load <Texture2D>("healthbar");
            enemy         = new Enemy();
            enemy.health  = 100;
            player.attack = 49;
            player.health = 100;

            //   enemy = new GameObject(content.Load<Texture2D>("Images/stages/floor"), new Vector2(0, 260));

            //player.position = new Vector2(screenSize.X / 20, screenSize.Y / 1.4f); // Set player starting position
            player.Position = new Vector2(255, 260);              // Set player starting position
            enemy.Position  = new Vector2(125, Floor.Position.Y); // Set player starting position

            //    cameraLocation = new Point(player.Position.ToPoint().X, player.Position.ToPoint().Y);

            spriteAnimations.Add("player", new Dictionary <string, SpriteAnimation>());
            spriteAnimations["player"].Add("stand", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/stand"), 3, 10));
            spriteAnimations["player"].Add("move", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/move"), 5, 20));
            spriteAnimations["player"].Add("jump", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/jump"), 2, 3));
            spriteAnimations["player"].Add("attack", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/attack"), 1, 15));
            spriteAnimations["player"].Add("crouch", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/crouch"), 1, 20));
            spriteAnimations["player"].Add("hurt", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/hurt"), 1, 10));
            spriteAnimations["player"].Add("moveLeft", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/move"), 1, 20));
            spriteAnimations["player"].Add("moveRight", new SpriteAnimation(content.Load <Texture2D>("Images/characters/player/move"), 1, 20));

            spriteAnimations["player"]["stand"].setSpriteSequence(new List <int>()
            {
                0, 1, 2, 1
            });
            spriteAnimations["player"]["move"].setSpriteSequence(new List <int>()
            {
                2, 1, 0, 1, 2, 3, 4, 3
            });
            spriteAnimations["player"]["jump"].setSpriteSequence(new List <int>()
            {
                0, 1
            });
            spriteAnimations["player"]["attack"].setSpriteSequence(new List <int>()
            {
                0
            });
            spriteAnimations["player"]["crouch"].setSpriteSequence(new List <int>()
            {
                0
            });
            spriteAnimations["player"]["hurt"].setSpriteSequence(new List <int>()
            {
                0
            });
            spriteAnimations["player"]["moveLeft"].setSpriteSequence(new List <int>()
            {
                2, 1, 0, 1, 2, 3, 4, 3
            });
            spriteAnimations["player"]["moveRight"].setSpriteSequence(new List <int>()
            {
                2, 1, 0, 1, 2, 3, 4, 3
            });


            player.spriteAnimations = spriteAnimations["player"];
            player.actionStateMachine.Change("stand");


            // TEMP - debugging purpose
            player.load();
            enemy.load();
            data = new Color[100 * 10];
            //progressBar();
        }
Exemple #3
0
 public JumpAction(AActor actor)
 {
     _actor = actor;
     _actionStateMachine = _actor.actionStateMachine;
 }