コード例 #1
0
ファイル: Jimothy.cs プロジェクト: m2pham/YellowMamba
 public override void LoadContent(ContentManager contentManager)
 {
     ContentManager = contentManager;
     PickHealthBarSprite = contentManager.Load<Texture2D>("PickHealthBar");
     SpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimwalk"), 1, 4);
     SpriteSheet tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimwalk"), 1, 4);
     StandingAnimation = new Animation(tempSpriteSheet, 5);
     JumpingAnimation = new Animation(tempSpriteSheet, 5);
     tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimrun"), 1, 4);
     RunningAnimation = new Animation(tempSpriteSheet, 5);
     tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimshoot"), 1, 4);
     ShootingAnimation = new Animation(tempSpriteSheet, 5);
     tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimattack"), 1, 3);
     AttackingAnimation = new Animation(tempSpriteSheet, 5);
     tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimshoot"), 1, 4);
     PrimeShotAnimation = new Animation(tempSpriteSheet, 1, 1, 5);
     tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/Jimattack"), 1, 3);
     PickingAnimation = new Animation(tempSpriteSheet, 2, 1, 5);
     tempSpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("Jimothy/hurt"), 1, 1);
     DamagedAnimation = new Animation(tempSpriteSheet, 5);
     CurrentAnimation = StandingAnimation;
     PickAggroBox.Width = Hitbox.Width + 100;
     PickAggroBox.Height = Hitbox.Height + 100;
     PickDefendingBox.Width = Hitbox.Width + 50;
     PickDefendingBox.Height = Hitbox.Height + 50;
     HitboxXDisplacement = 80;
     HitboxYDisplacement = 20;
     Hitbox.Width = SpriteSheet.FrameWidth - 2 * HitboxXDisplacement;
     Hitbox.Height = SpriteSheet.FrameHeight - 2 * HitboxYDisplacement;
     // 87 is distance from top of frame to arm
     AttackHitbox = new Rectangle((int)(Position.X + HitboxXDisplacement), (int)Position.Y + 70, (int)AttackRange.X, (int)AttackRange.Y);
 }
コード例 #2
0
ファイル: Animation.cs プロジェクト: m2pham/YellowMamba
        public Animation(SpriteSheet spriteSheet, int frequency)
        {
            this.spriteSheet = spriteSheet;
            this.Frequency = frequency;
            this.startingFrame = 1;
            this.NumFrames = spriteSheet.Rows * spriteSheet.Columns;

            currentFrame = startingFrame;
            currentFrequency = 0;
        }
コード例 #3
0
ファイル: Animation.cs プロジェクト: m2pham/YellowMamba
        public Animation(SpriteSheet spriteSheet, int startingFrame, int numFrames, int frequency)
        {
            this.spriteSheet = spriteSheet;
            this.Frequency = frequency;
            this.startingFrame = startingFrame;
            this.NumFrames = numFrames;

            currentFrame = startingFrame;
            currentFrequency = 0;
        }
コード例 #4
0
ファイル: Swatter.cs プロジェクト: m2pham/YellowMamba
 public override void LoadContent(ContentManager contentManager)
 {
     SpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("BasicEnemy"), 1, 7);
     StandingAnimation = new Animation(SpriteSheet, 5, 2, 5);
     RunningAnimation = new Animation(SpriteSheet, 4, 1, 5);
     AttackingAnimation = new Animation(SpriteSheet, 1, 2, 5);
     DamagedAnimation = new Animation(SpriteSheet, 7, 1, 5);
     CurrentAnimation = StandingAnimation;
     //Hitbox.Width = animatedSprite.FrameWidth;
     //Hitbox.Height = animatedSprite.FrameHeight;
     
     //have to change according to sprite
     Hitbox.Width = 72;
     Hitbox.Height = 72;
 }
コード例 #5
0
ファイル: Chaser.cs プロジェクト: m2pham/YellowMamba
 public override void LoadContent(ContentManager contentManager)
 {
     this.contentManager = contentManager;
     SpriteSheet = new SpriteSheet(contentManager.Load<Texture2D>("mon4/mon4_sprite_base"), 6, 14);
     StandingAnimation = new Animation(SpriteSheet, 1, 4, 5);
     RunningAnimation = new Animation(SpriteSheet, 15, 9, 5);
     AttackingAnimation = new Animation(SpriteSheet, 29, 5, 5);
     DamagedAnimation = new Animation(SpriteSheet, 57, 3, 5);
     DeathAnimation = new Animation(SpriteSheet, 57, 8, 5);
     CurrentAnimation = StandingAnimation;
     //Hitbox.Width = animatedSprite.FrameWidth;
     //Hitbox.Height = animatedSprite.FrameHeight;
     HitboxXDisplacement = 22 * (int)scale;
     HitboxYDisplacement = 25 * (int)scale;
     Hitbox.Width = SpriteSheet.FrameWidth * (int)scale - HitboxXDisplacement * 2;
     Hitbox.Height = 25 * (int)scale;
     AttackRange = new Vector2(12 * scale, 15 * scale);
     AttackHitbox = new Rectangle((int)(Position.X + HitboxXDisplacement), (int)Position.Y + 28, (int)AttackRange.X, (int)AttackRange.Y);
 }