Ejemplo n.º 1
0
        public MenuBGObject(Node node) : base(node)
        {
            var vector = new Vector2(30, -300);

            Image         = new SpriteX(this, "PlanetMenu/Menu_BG.png", vector);
            Image.Color.A = 0;
            Image.RunAction(new TintBy(new Vector4(0f, 0f, 0f, 1f), 1f));
            Image.Moveby(new Vector2(0, 320), 1f);
        }
Ejemplo n.º 2
0
        public MenuButton(Node node, string path, SelectTodo selectTodo, int num) : base(node)
        {
            Num             = num;
            this.selectTodo = selectTodo;
            var vector = new Vector2(0, 90 + Num * 60);

            Image         = new SpriteX(this, path, vector, new Vector2i(1, 2), new Vector2i(1, 1));
            Image.Color.A = 0;
            ShowTime      = new Ticker(0.65f + Num * 0.12f);
        }
Ejemplo n.º 3
0
 private void AddBackground(string Name)
 {
     if (Name != "")
     {
         backGroundPic = new SpriteX(BackGround, "BG/" + Name, Vector2.Zero);
     }
     else
     {
         backGroundPic = new SpriteX(BackGround, "BG/Default.png", Vector2.Zero);
     }
 }
Ejemplo n.º 4
0
 public BBullet(Node node, Vector2 pos, Vector2 Dir, float Speed,
                float w, float h, WeapRanType wrt, ContactType ctype, float att, string path) :
     base(node, 0, 0, pos, w, h, ctype, null, null)
 {
     this.Att   = att;
     this.Speed = Speed;
     this.Dir   = Dir;
     body       = new SpriteX(path, pos);
     body.ChangeFather(this);
     body.CenterSprite(TRS.Local.Center);
     body.Color  = new Vector4(12 / 255f, 255 / 255f, 98 / 255f, 255f / 255f);
     maxShootDis = BWeapon.GetRangeByType(wrt);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 构造一个宇宙舰基对象,不会碰撞的
        /// </summary>
        public BWarship(Node node, Vector2 pos, string path) :
            base(node, 1, 1)
        {
            body = new SpriteX(path, pos);
            body.ChangeFather(this);
            body.CenterSprite(TRS.Local.Center);

            Speed           = 8f;
            MaxRotSpeed     = 0.02f;
            RotSpeed        = MaxRotSpeed;
            RotSpeedInc     = 0.002f;
            this.Body.Scale = allWarshipScale;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 构造一个宇宙舰基对象,会碰撞的
        /// </summary>
        public BWarship(Node node, Vector2 pos, float width, float height,
                        ContactType ctype, ContactDeal td, ContactDeal bd, string path) :
            base(node, 0, 0, pos, width, height, ctype, td, bd)
        {
            body = new SpriteX(this, path, pos);
            body.CenterSprite(TRS.Local.Center);
            HP = 100;

            Speed           = 8f;
            MaxRotSpeed     = 0.02f;
            RotSpeed        = MaxRotSpeed;
            RotSpeedInc     = 0.002f;
            this.Body.Scale = allWarshipScale;
        }
Ejemplo n.º 7
0
        public BBomb(Node node, Vector2 pos, Vector2 Dir, float Speed,
                     float w, float h, WeapRanType wrt, float startBomb, float NoContactTime, ContactType ctype, float att, string path) :
            base(node, 0, 0, pos, w, h, ctype, null, null)
        {
            this.Att = att;

            this.NoContactTime = NoContactTime;
            this.Speed         = Speed;
            this.Dir           = Dir;
            body = new SpriteX(path, pos);
            body.ChangeFather(this);
            body.CenterSprite(TRS.Local.Center);

            //
            body.Scale = new Vector2(12f, 12f);
            body.Color = new Vector4(220 / 255f, 82 / 255f, 98 / 255f, 255f / 255f);
            //base.drawBoundBox = new DrawBoundBox(this);
        }
Ejemplo n.º 8
0
        public BMissile(Node node, Vector2 pos, BWarship target, float Speed, float rots, float rotsInc,
                        float w, float h, WeapRanType wrt, ContactType ctype, float att, string path) :
            base(node, 0, 0, pos, w, h, ctype, null, null)
        {
            this.Att    = att;
            this.Speed  = Speed;
            this.target = target;

            body = new SpriteX(path, pos);
            body.ChangeFather(this);
            body.CenterSprite(TRS.Local.Center);
            body.Scale = new Vector2(0.4f, 0.4f);

            tracker = new BTracker(body, ref this.Speed, rots, rotsInc);
            tracker.SetTarger(target.GetPosition());

            body.Color  = BWarship.ColorID;
            maxShootDis = BWeapon.GetRangeByType(wrt);
        }
Ejemplo n.º 9
0
        public BattleMap(Node node)
            : base(node)
        {
            background = new SpriteX("Battles//background.png", new Vector2(-100, -100));
            background.ChangeFather(this);
            boundaryWarner = new SpriteX("Battles//BoundaryWarning.png", NoDisplayPos);
            boundaryWarner.ChangeFather(this);
            boundaryWarner.CenterSprite(TRS.Local.Center);

            Vector2 pos;
            SpriteX x;

            for (int i = 0; i < starCount; i++)
            {
                pos = new Vector2(Maths.Rnd.Next((int)(-BattleScene.Width * 0.5f - 100), (int)(BattleScene.Width * 0.5f + 100)),
                                  Maths.Rnd.Next((int)(-BattleScene.Heigth * 0.5f - 100), (int)(BattleScene.Heigth * 0.5f + 100)));
                x = new SpriteX("Battles//star.png", pos);
                x.ChangeFather(this);
                x.CenterSprite(TRS.Local.Center);
            }
        }
Ejemplo n.º 10
0
        public override void Start()
        {
            //先加载资源
            GameData.LoadTextureInfo("Battles//background.png");
            GameData.LoadTextureInfo("Battles//BoundaryWarning.png");
            GameData.LoadTextureInfo("Battles//primitive.png");
            GameData.LoadTextureInfo("Battles//star.png");
            GameData.LoadTextureInfo("Battles//test.png");
            GameData.LoadTextureInfo("Battles//testship.png");
            GameData.LoadTextureInfo("Battles//testwingman.png");

            bacgroundBack = new Layer();
            bacground     = new Layer();
            middle        = new Layer();
            front         = new Layer();

            this.AddChild(bacgroundBack);             //最下层
            this.AddChild(bacground);
            this.AddChild(middle);
            this.AddChild(front);

            LeftLimit  = -Width * 0.5f;
            RightLimit = Width * 0.5f;
            UpLimit    = -Heigth * 0.5f;
            DownLimit  = Heigth * 0.5f;

            map          = new BattleMap(bacgroundBack);
            enemy        = new BEnemyManager(middle, this);
            player       = new BPlayer(middle, this);
            otherSprites = new SpriteX(this, "Battles//test.png", new Vector2(0, 0));
            otherSprites.CenterSprite(TRS.Local.Center);

            //锁定
            player.SetCanLockEnemys(enemy.GetAllWarships());
            enemy.SetCanLockEnemys(player.GetAllWarships());

            base.Start();
        }
Ejemplo n.º 11
0
 public TextBG()
 {
     image = new SpriteX(this, "AVG/TextBox.png", new Vector2(179, 364));
 }
Ejemplo n.º 12
0
 public TitleButton(Node node) : base(node)
 {
     Image = new SpriteX(this, "MainMenu/Menu_Title.png", new Vector2(247, 96));
 }
Ejemplo n.º 13
0
 public MainMenuButton(Node node, string path, Vector2 vector2, SelectTodo selectTodo) : base(node)
 {
     this.selectTodo = selectTodo;
     Image           = new SpriteX(this, path, vector2, new Vector2i(1, 2), new Vector2i(1, 1));
 }