Esempio n. 1
0
        public enemy1(Vector2 position, int width, int height, Vector2 velocity, float rotation, Vector2 origin, Vector2 scale, Color color, bool islive)
        {
            _texture       = MyContentManager.GetInstance().LoadContent <Texture2D>("pig1_230x85");
            _idleAnimation = new Animation();
            _idleAnimation.AddFrame(new Rectangle(0, 0, 115, 85), TimeSpan.FromSeconds(.25));
            _idleAnimation.AddFrame(new Rectangle(115, 0, 115, 85), TimeSpan.FromSeconds(.25));
            isTurnright = true;

            _upray    = new Ray2D(new Vector2(position.X + width / 2, position.Y), new Vector2(0, -0.01f));
            _downray  = new Ray2D(new Vector2(position.X + width / 2, position.Y + height), new Vector2(0, 0.01f));
            _rightray = new Ray2D(new Vector2(position.X + width, position.Y + height / 2), new Vector2(0.01f, 0));
            _leftray  = new Ray2D(new Vector2(position.X, position.Y + height / 2), new Vector2(-0.01f, 0));

            _canUp    = true;
            _canDown  = true;
            _canRight = true;
            _canLeft  = true;

            _speed      = 2;
            Health      = 10;
            _isfindHero = false;
            _state      = EnemyPigState.XL;

            changetime  = 2.0f;
            changetimer = 0.0f;
            rushtime    = 0.7f;
            rushtimer   = 0.0f;
            stoptime    = 2.0f;
            stoptimer   = 0.0f;

            rnd    = new Random();
            rndnum = 0;

            EnemySprite = new Sprite(position, width, height, velocity, rotation, origin, scale, color, islive);
        }
Esempio n. 2
0
 public tile1()
 {
     _texture  = MyContentManager.GetInstance().LoadContent <Texture2D>("tile1");
     _tileList = new List <Rectangle>();
     _tileList.Add(new Rectangle(0, 0, 100, 100));
     _tileList.Add(new Rectangle(100, 0, 100, 100));
     _tileList.Add(new Rectangle(200, 0, 100, 100));
 }
Esempio n. 3
0
        public smallGun(Vector2 position, int width, int height, Vector2 velocity, float rotation, Vector2 origin, Vector2 scale, Color color, bool islive)
        {
            _bulletData    = MyContentManager.GetInstance().LoadContent <MyXMLData.BulletData.bullet1_data>("bullet1_data");
            _weaponTexture = MyContentManager.GetInstance().LoadContent <Texture2D>("samllgun");
            WeaponSprite   = new Sprite(position, width, height, velocity, rotation, origin, scale, color, islive);
            var tempx = (float)(WeaponSprite.Width * Math.Cos(WeaponSprite.Rotation));
            var tempy = (float)(WeaponSprite.Width * Math.Sin(WeaponSprite.Rotation));

            _firePosition = WeaponSprite.Position + new Vector2(tempx, tempy);
        }
Esempio n. 4
0
        public boomEffect1(Vector2 position)
        {
            _position              = position;
            BoomAnimation          = new Animation();
            BoomAnimation.IsLoop   = false;
            BoomAnimation.FrameNum = 5;
            Texture = MyContentManager.GetInstance().LoadContent <Texture2D>("boomEffect1");
            BoomAnimation.AddFrame(new Rectangle(0, 0, 33, 32), TimeSpan.FromSeconds(.15));
            BoomAnimation.AddFrame(new Rectangle(33, 0, 33, 32), TimeSpan.FromSeconds(.15));
            BoomAnimation.AddFrame(new Rectangle(66, 0, 33, 32), TimeSpan.FromSeconds(.15));
            BoomAnimation.AddFrame(new Rectangle(99, 0, 33, 32), TimeSpan.FromSeconds(.15));
            BoomAnimation.AddFrame(new Rectangle(132, 0, 33, 32), TimeSpan.FromSeconds(.15));

            _currentAnimation = BoomAnimation;
        }
Esempio n. 5
0
        public EnemyBoom1(Vector2 position)
        {
            _position              = position;
            BoomAnimation          = new Animation();
            BoomAnimation.IsLoop   = false;
            BoomAnimation.FrameNum = 6;
            Texture = MyContentManager.GetInstance().LoadContent <Texture2D>("EnemyBoom1");
            BoomAnimation.AddFrame(new Rectangle(0, 0, 100, 100), TimeSpan.FromSeconds(.1));
            BoomAnimation.AddFrame(new Rectangle(100, 0, 100, 100), TimeSpan.FromSeconds(.1));
            BoomAnimation.AddFrame(new Rectangle(200, 0, 100, 100), TimeSpan.FromSeconds(.1));
            BoomAnimation.AddFrame(new Rectangle(300, 0, 100, 100), TimeSpan.FromSeconds(.1));
            BoomAnimation.AddFrame(new Rectangle(400, 0, 100, 100), TimeSpan.FromSeconds(.1));
            BoomAnimation.AddFrame(new Rectangle(500, 0, 100, 100), TimeSpan.FromSeconds(.1));

            _currentAnimation = BoomAnimation;
        }
Esempio n. 6
0
        public Boss1(Vector2 position, int width, int height, Vector2 velocity, float rotation, Vector2 origin, Vector2 scale, Color color, bool islive)
        {
            _texture       = MyContentManager.GetInstance().LoadContent <Texture2D>("enemyBoss");
            _idleAniamtion = new Animation();
            _idleAniamtion.AddFrame(new Rectangle(0, 0, 163, 154), TimeSpan.FromSeconds(.25));
            _currentAnimation = _idleAniamtion;

            isTurnright  = true;
            _bulletspeed = 10;
            _speed       = 2;
            Health       = 100;
            EnemySprite  = new Sprite(position, width, height, velocity, rotation, origin, scale, color, islive);

            _upray    = new Ray2D(new Vector2(position.X + width / 2, position.Y), new Vector2(0, -0.01f));
            _downray  = new Ray2D(new Vector2(position.X + width / 2, position.Y + height), new Vector2(0, 0.01f));
            _rightray = new Ray2D(new Vector2(position.X + width, position.Y + height / 2), new Vector2(0.01f, 0));
            _leftray  = new Ray2D(new Vector2(position.X, position.Y + height / 2), new Vector2(-0.01f, 0));

            _canUp    = true;
            _canDown  = true;
            _canRight = true;
            _canLeft  = true;

            movetime      = 3.0f;
            rushtime      = 1.5f;
            attacktime    = 2.0f;
            supattacktime = 2.0f;
            delay         = 0.2f;

            movetimer      = 0.0f;
            rushtimer      = 0.0f;
            attacktimer    = 0.0f;
            supattacktimer = 0.0f;
            firetimer      = 0.0f;



            _state = BossState.MOVE;
        }
Esempio n. 7
0
        public enemygGBL(Vector2 position, int width, int height, Vector2 velocity, float rotation, Vector2 origin, Vector2 scale, Color color, bool islive)
        {
            _texture       = MyContentManager.GetInstance().LoadContent <Texture2D>("enemyGBL");
            _idleAniamtion = new Animation();
            _idleAniamtion.AddFrame(new Rectangle(0, 0, 100, 130), TimeSpan.FromSeconds(.25));
            _idleAniamtion.AddFrame(new Rectangle(100, 0, 100, 130), TimeSpan.FromSeconds(.25));
            _currentAnimation = _idleAniamtion;

            isTurnright  = true;
            _bulletspeed = 10;
            _speed       = 2;
            Health       = 10;
            EnemySprite  = new Sprite(position, width, height, velocity, rotation, origin, scale, color, islive);


            _upray    = new Ray2D(new Vector2(position.X + width / 2, position.Y), new Vector2(0, -0.01f));
            _downray  = new Ray2D(new Vector2(position.X + width / 2, position.Y + height), new Vector2(0, 0.01f));
            _rightray = new Ray2D(new Vector2(position.X + width, position.Y + height / 2), new Vector2(0.01f, 0));
            _leftray  = new Ray2D(new Vector2(position.X, position.Y + height / 2), new Vector2(-0.01f, 0));

            _canUp    = true;
            _canDown  = true;
            _canRight = true;
            _canLeft  = true;

            rnd    = new Random();
            _state = GBLSate.XL;
            rndnum = rnd.Next(0, 4);

            changetime  = 2.0f;
            changetimer = 0.0f;
            stoptime    = 2.0f;
            stoptimer   = 0.0f;
            attacktime  = 2.0f;
            attacktimer = 0.0f;
            firetime    = 0.5f;
            firetimer   = 0.0f;
        }
Esempio n. 8
0
        public Stage1()
        {
            _wallTexture = MyContentManager.GetInstance().LoadContent <Texture2D>("wall1");
            stagedata    = new MyXMLData.StageData.Stage1Data();
            stagedata    = MyContentManager.GetInstance().LoadContent <MyXMLData.StageData.Stage1Data>("stage1data");

            _tile = new TileObject.tile1();
            for (int i = 0; i < _width; i++)
            {
                for (int j = 0; j < _height; j++)
                {
                    if (stagedata.tilemap[i * _width + j] == 3)
                    {
                        WallObject.wall1 wall = new WallObject.wall1(_wallTexture, new Vector2(i * 100, j * 100));
                        GameManager.GetInstance().AddWall(wall);
                    }
                }
            }

            enemyupdatetime  = delay;
            enemyupdatetimer = 0.0f;

            boss = new EnemyBoosObject.Boss1(new Vector2(1500, 1500), 163, 154, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true);

            _enemyList.Add(new EnemyObject.enemy1(new Vector2(100, 100), 115, 85, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemygGBL(new Vector2(500, 100), 100, 130, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemy1(new Vector2(800, 100), 115, 85, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemygGBL(new Vector2(100, 500), 100, 130, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemy1(new Vector2(100, 800), 115, 85, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemygGBL(new Vector2(500, 500), 100, 130, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemy1(new Vector2(700, 700), 115, 85, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemygGBL(new Vector2(900, 900), 100, 130, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemy1(new Vector2(1000, 1000), 115, 85, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));
            _enemyList.Add(new EnemyObject.enemygGBL(new Vector2(1200, 1100), 100, 130, new Vector2(5, 5), 0, new Vector2(0, 0), new Vector2(1, 1), Color.White, true));

            SoundManager.Getinstance().PlayBGM();
        }
Esempio n. 9
0
        public Hero(Vector2 position, int width, int height, Vector2 velocity, float rotation, Vector2 origin, Vector2 scale, Color color, bool islive)
        {
            _data    = MyContentManager.GetInstance().LoadContent <MyXMLData.HeroData>("herodata");
            _texture = MyContentManager.GetInstance().LoadContent <Texture2D>(_data.spritePath);
            _sprite  = new Sprite(position, width, height, velocity, rotation, origin, scale, color, islive);

            _weaponPosition = new Vector2(80, 100);

            health       = 10;
            _isMoveRight = true;
            state        = HeroState.NORMAL;
            _blinktime   = 0.0f;

            _idleAnimation = new Animation();
            _idleAnimation.AddFrame(new Rectangle(0, 0, 120, 140), TimeSpan.FromSeconds(.25));
            _idleAnimation.AddFrame(new Rectangle(120, 0, 120, 140), TimeSpan.FromSeconds(.25));
            _idleAnimation.AddFrame(new Rectangle(240, 0, 120, 140), TimeSpan.FromSeconds(.25));
            _idleAnimation.AddFrame(new Rectangle(360, 0, 120, 140), TimeSpan.FromSeconds(.25));

            _isBlinkAnimation = new Animation();
            _isBlinkAnimation.AddFrame(new Rectangle(480, 0, 120, 140), TimeSpan.FromSeconds(.1));
            _isBlinkAnimation.AddFrame(new Rectangle(0, 0, 120, 140), TimeSpan.FromSeconds(.1));

            _upray1 = new Ray2D(new Vector2(position.X + _offset, position.Y), new Vector2(0, -0.01f));
            //_upray1 = new Ray2D(new Vector2(position.X + width - _offset, position.Y), new Vector2(0, -0.01f));
            _downray1 = new Ray2D(new Vector2(position.X + _offset, position.Y + height), new Vector2(0, +0.01f));
            //_downray1 = new Ray2D(new Vector2(position.X + width - _offset, position.Y + height), new Vector2(0, +0.01f));
            _rightray1 = new Ray2D(new Vector2(position.X + width, position.Y + _offset), new Vector2(0.01f, 0));
            //_rightray1 = new Ray2D(new Vector2(position.X + width, position.Y + height - _offset), new Vector2(0.01f, 0));
            _leftray1 = new Ray2D(new Vector2(position.X, position.Y + _offset), new Vector2(-0.01f, 0));
            //_leftray1 = new Ray2D(new Vector2(position.X, position.Y + height - _offset), new Vector2(-0.01f, 0));

            _canUp    = true;
            _canDown  = true;
            _canRight = true;
            _canLeft  = true;
        }
 public override void Initialize()
 {
     _heartTexture = MyContentManager.GetInstance().LoadContent <Texture2D>("herohealth");
     _font         = MyContentManager.GetInstance().LoadContent <SpriteFont>("DefaultFomt");
     base.Initialize();
 }
Esempio n. 11
0
 public bossbullet1(Vector2 position, int width, int height, Vector2 velocity, float rotation, Vector2 origin, Vector2 scale, Color color, bool islive)
 {
     _texture     = MyContentManager.GetInstance().LoadContent <Texture2D>("bossbullet");
     BulletSprite = new Sprite(position, width, height, velocity, rotation, origin, scale, color, islive);
 }
Esempio n. 12
0
 public override void Initialize()
 {
     _bloodbar = MyContentManager.GetInstance().LoadContent <Texture2D>("bossBoledBar");
     _blood    = MyContentManager.GetInstance().LoadContent <Texture2D>("bossblood");
     base.Initialize();
 }