Ejemplo n.º 1
0
 public Block(Vector2 Position)
 {
     sprite            = Game1.content.Load <Texture2D>("Hero");
     kinetics          = Kinetic.ZERO();
     kinetics.position = Position;
     Kinetic.SetBoundingBoxDimensions(ref kinetics.boundingBox, sprite);
     dead = false;
 }
Ejemplo n.º 2
0
 public DamageBox(Vector2 Position, Vector2 Velocity, int Time, bool Friendly)
 {
     sprite            = Game1.content.Load <Texture2D>("Hero");
     kinetics          = Kinetic.ZERO();
     kinetics.position = Position;
     kinetics.velocity = Velocity;
     Kinetic.SetBoundingBoxDimensions(ref kinetics.boundingBox, sprite);
     dead     = false;
     time     = Time;
     friendly = Friendly;
     anim     = new Animation();
 }
Ejemplo n.º 3
0
        void InitializeAnimation()
        {
            kinetics          = Kinetic.ZERO();
            kinetics.position = new Vector2(100, 100);
            Kinetic.SetBoundingBoxDimensions(ref kinetics.boundingBox, Game1.content.Load <Texture2D>(@"Enemy\Up\enemy-up-2"));

            Animation Up = new Animation();

            Up.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Up\enemy-up-2"));
            Up.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Up\enemy-up-1"));
            Up.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Up\enemy-up-2"));
            Up.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Up\enemy-up-3"));
            Up.SetTime(10);
            Up.SetFrame(0);

            Animation Down = new Animation();

            Down.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Down\enemy-wc-down-2"));
            Down.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Down\enemy-wc-down-1"));
            Down.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Down\enemy-wc-down-2"));
            Down.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Down\enemy-wc-down-3"));
            Down.SetTime(10);
            Down.SetFrame(0);

            Animation Left = new Animation();

            Left.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Left\wc-left-2"));
            Left.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Left\wc-left-1"));
            Left.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Left\wc-left-2"));
            Left.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Left\wc-left-3"));
            Left.SetTime(10);
            Left.SetFrame(0);

            Animation Right = new Animation();

            Right.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Right\wc-right-2"));
            Right.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Right\wc-right-1"));
            Right.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Right\wc-right-2"));
            Right.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Right\wc-right-3"));
            Right.SetTime(10);
            Right.SetFrame(0);

            Animation Idle = new Animation();

            Idle.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Up\enemy-up-2"));
            Idle.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Down\enemy-wc-down-2"));
            Idle.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Left\wc-left-3"));
            Idle.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\Right\wc-right-3"));
            Idle.SetTime(10);
            Idle.SetFrame(0);


            walk = new DirectionAnimationPacket();
            walk.InitializeAnimation(Up, DirectionAnimationPacket.Animations.UP);
            walk.InitializeAnimation(Down, DirectionAnimationPacket.Animations.DOWN);
            walk.InitializeAnimation(Left, DirectionAnimationPacket.Animations.LEFT);
            walk.InitializeAnimation(Right, DirectionAnimationPacket.Animations.RIGHT);
            walk.InitializeAnimation(Idle, DirectionAnimationPacket.Animations.IDLE);
            walk.setAnimation(DirectionAnimationPacket.Animations.IDLE);

            Animation AttackUp    = new Animation();
            int       attackSpeed = 3;

            AttackUp.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackUp\enemy-attack-up-1"));
            AttackUp.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackUp\enemy-attack-up-2"));
            AttackUp.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackUp\enemy-attack-up-3"));
            AttackUp.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackUp\enemy-attack-up-4"));
            AttackUp.SetTime(attackSpeed);
            AttackUp.Offset(new Vector2(-64, -64));
            AttackUp.SetFrame(0);

            Animation AttackDown = new Animation();

            AttackDown.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackDown\enemy-attack-down-1"));
            AttackDown.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackDown\enemy-attack-down-2"));
            AttackDown.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackDown\enemy-attack-down-3"));
            AttackDown.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackDown\enemy-attack-down-4"));
            AttackDown.SetTime(attackSpeed);
            AttackDown.SetFrame(0);

            Animation AttackLeft = new Animation();

            AttackLeft.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackLeft\enemy-attack-left-1"));
            AttackLeft.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackLeft\enemy-attack-left-2"));
            AttackLeft.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackLeft\enemy-attack-left-3"));
            AttackLeft.SetTime(attackSpeed);
            AttackLeft.Offset(new Vector2(-64, -64));
            AttackLeft.SetFrame(0);

            Animation AttackRight = new Animation();

            AttackRight.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackRight\enemy-attack-right-1"));
            AttackRight.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackRight\enemy-attack-right-2"));
            AttackRight.AddFrame(Game1.content.Load <Texture2D>(@"Enemy\AttackRight\enemy-attack-right-3"));
            AttackRight.SetTime(attackSpeed);
            AttackRight.Offset(new Vector2(-0, -64));
            AttackRight.SetFrame(0);

            attack = new DirectionAnimationPacket();
            attack.InitializeAnimation(AttackUp, DirectionAnimationPacket.Animations.UP);
            attack.InitializeAnimation(AttackDown, DirectionAnimationPacket.Animations.DOWN);
            attack.InitializeAnimation(AttackLeft, DirectionAnimationPacket.Animations.LEFT);
            attack.InitializeAnimation(AttackRight, DirectionAnimationPacket.Animations.RIGHT);
            attack.setAnimation(DirectionAnimationPacket.Animations.RIGHT);


            current = walk;
        }