/// <summary> /// 同Draw,但精灵不显示 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> /// <param name='cutImage'> /// 切分的块数 /// </param> /// <param name='showPiece'> /// 显示的图片部分坐标 /// </param> public SpriteX LoadImage(Layer layer, string name, string path, Vector2 vector, Vector2i cutImage, Vector2i showPiece) { SpriteX sprite = DrawImage(layer, name, path, vector, cutImage, showPiece); sprite.Visible = false; return(sprite); }
public DrawBoundBox(Node node) : base(node) { SpriteX p; // for(int i=0; i<4;i++) // { // p = new SpriteX(this,"Battles//primitive.png", // new Vector2(-9999,-9999)); // p.CenterSprite(TRS.Local.Center); // p.Color = new Vector4(37 / 255f, 255 / 255f, 28 / 255f, 255f / 255f); // p.Scale =new Vector2(0.7f,0.7f); // aabbPoints.Add(p); // } // for(int i=0; i<4;i++) // { // p = new SpriteX(this,"Battles//primitive.png", // new Vector2(-9999,-9999)); // p.CenterSprite(TRS.Local.Center); // p.Scale =new Vector2(0.7f,0.7f); // p.Color = new Vector4(227 / 255f, 64 / 255f, 255 / 255f, 255f / 255f); // obbPoints.Add(p); // } // for(int i=0; i<8;i++) { p = new SpriteX("Battles//primitive.png", new Vector2(-9999,-9999)); p.ChangeFather(this); p.CenterSprite(TRS.Local.Center); p.Scale =new Vector2(0.7f,0.7f); p.Color = new Vector4(52 / 255f, 150 / 255f, 255 / 255f, 255f / 255f); circlePoints.Add(p); } }
/// <summary> /// 同Draw,但精灵不显示 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> public SpriteX LoadImage(Layer layer, string name, string path, Vector2 vector) { SpriteX sprite = DrawImage(layer, name, path, vector); sprite.Visible = false; return(sprite); }
/// <summary> /// 绘制一个新的精灵,可设置精灵坐标以及进行切分 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> /// <param name='cutImage'> /// 切分的块数 /// </param> /// <param name='showPiece'> /// 显示的图片部分坐标 /// </param> public SpriteX DrawImage(Layer layer, string name, string path, Vector2 vector, Vector2i cutImage, Vector2i showPiece) { var sprite = new SpriteX(layer, path, vector, cutImage, showPiece); sprite.Name = name; spriteDictionary.Add(name, sprite); return(sprite); }
/// <summary> /// 绘制一个新的精灵,可设置坐标及显示部分 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> /// <param name='rectangle'> /// 表示显示起始坐标及结束坐标的矩形 /// </param> public SpriteX DrawImage(Layer layer, string name, string path, Vector2 vector, BoundBox rectangle) { var sprite = new SpriteX(layer, path, vector, rectangle); sprite.Name = name; spriteDictionary.Add(name, sprite); return(sprite); }
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); }
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); }
/// <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; }
public BTracker(SpriteX sprite, ref float moveSpeed, float RotSpeed, float RotSpeedInc) { currentTarget = sprite.GetPosition(); newTarget = sprite.GetPosition(); Speed = moveSpeed; this.sprite = sprite; IsTracking = false; IsReached = false; this.MaxRotSpeed = RotSpeed; this.RotSpeed = RotSpeed; this.RotSpeedInc = RotSpeedInc; }
public BTracker(SpriteX sprite,ref float moveSpeed,float RotSpeed, float RotSpeedInc) { currentTarget = sprite.GetPosition(); newTarget = sprite.GetPosition(); Speed = moveSpeed ; this.sprite =sprite; IsTracking = false; IsReached = false; this.MaxRotSpeed = RotSpeed; this.RotSpeed = RotSpeed; this.RotSpeedInc = RotSpeedInc; }
/// <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; }
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); }
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); }
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); } }
public DrawBoundBox(Node node) : base(node) { SpriteX p; // for(int i=0; i<4;i++) // { // p = new SpriteX(this,"Battles//primitive.png", // new Vector2(-9999,-9999)); // p.CenterSprite(TRS.Local.Center); // p.Color = new Vector4(37 / 255f, 255 / 255f, 28 / 255f, 255f / 255f); // p.Scale =new Vector2(0.7f,0.7f); // aabbPoints.Add(p); // } // for(int i=0; i<4;i++) // { // p = new SpriteX(this,"Battles//primitive.png", // new Vector2(-9999,-9999)); // p.CenterSprite(TRS.Local.Center); // p.Scale =new Vector2(0.7f,0.7f); // p.Color = new Vector4(227 / 255f, 64 / 255f, 255 / 255f, 255f / 255f); // obbPoints.Add(p); // } // for (int i = 0; i < 8; i++) { p = new SpriteX("Battles//primitive.png", new Vector2(-9999, -9999)); p.ChangeFather(this); p.CenterSprite(TRS.Local.Center); p.Scale = new Vector2(0.7f, 0.7f); p.Color = new Vector4(52 / 255f, 150 / 255f, 255 / 255f, 255f / 255f); circlePoints.Add(p); } }
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 (); }
//Draw指令 /// <summary> /// 绘制一个新的精灵,默认在左上角 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> public SpriteX DrawImage(Layer layer, string name, string path) { SpriteX sprite = DrawImage(layer, name, path, Vector2.Zero); return(sprite); }
/// <summary> /// 绘制一个新的精灵,可设置精灵坐标 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> public SpriteX DrawImage(Layer layer, string name, string path, Vector2 vector) { SpriteX sprite = DrawImage(layer, name, path, vector, new Vector2i(1, 1), new Vector2i(1, 1)); return(sprite); }
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); }
/// <summary> /// 绘制一个新的精灵,可设置精灵坐标以及进行切分 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> /// <param name='cutImage'> /// 切分的块数 /// </param> /// <param name='showPiece'> /// 显示的图片部分坐标 /// </param> public SpriteX DrawImage(Layer layer,string name,string path,Vector2 vector,Vector2i cutImage,Vector2i showPiece) { var sprite = new SpriteX(layer,path,vector,cutImage,showPiece); sprite.Name = name; spriteDictionary.Add(name,sprite); return sprite; }
public Player(Node node,float CreatTime,float DieTime) : base(node,CreatTime,DieTime) { hero = new SpriteX(this,"hero2.png",new Vector2(200f,200f),new Vector2i(20,5),new Vector2i(1,1)); }
public TitleButton(Node node) : base(node) { Image = new SpriteX(this,"MainMenu/Menu_Title.png",new Vector2(247,96)); }
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)); }
public TextBG() { image = new SpriteX(this,"AVG/TextBox.png",new Vector2(179,364)); }
/// <summary> /// 绘制一个新的精灵,可设置坐标及显示部分 /// </summary> /// <returns> /// 创建的精灵 /// </returns> /// <param name='name'> /// 精灵名称 /// </param> /// <param name='path'> /// 纹理地址 /// </param> /// <param name='vector'> /// 精灵坐标 /// </param> /// <param name='rectangle'> /// 表示显示起始坐标及结束坐标的矩形 /// </param> public SpriteX DrawImage(Layer layer,string name,string path,Vector2 vector,BoundBox rectangle) { var sprite = new SpriteX(layer,path,vector,rectangle); sprite.Name = name; spriteDictionary.Add(name,sprite); return sprite; }
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); }
public Player(Node node, float CreatTime, float DieTime) : base(node, CreatTime, DieTime) { hero = new SpriteX(this, "hero2.png", new Vector2(200f, 200f), new Vector2i(20, 5), new Vector2i(1, 1)); }