发表一个自己做的WPF游戏
山寨了一下植物大战僵尸
测试地址:
文件名:Debugsg.zip,访问地址:http://www.kuaipan.cn/index.php?ac=file&oid=5452452392344978
1 ///<summary>
2 /// SpritObject.xaml 的交互逻辑
3 ///</summary>
4 public partial class SpritObject : UserControl
5 {
6 //public string Code;
7 public string _m名字;
8 public string _c称号;
9 public int _x消耗酒个数;
10 public int _d当前血值;
11 public int _d当前法值;
12 public int _z最大血值;
13 public int _z最大法值;
14 public int _z最大攻击值;
15 public int _z最小攻击值;
16 public int _b爆击值;
17 public int _b爆击率;
18 public string _j技能;
19 public int _j技能率;
20 public string _z状态;//(减速,正常,中毒,加速,受伤,眩晕,迷失)-->
21 public int _x行进系数;
22 public int _t图片切换间隔时间;
23 public string _c出场对白;
24 public string _z战斗对白;
25 public string _t退场对白;
26 public string _g挂掉对白;//!--说明:对白可多条,随机显示-->
27 public Point _z坐标;
28 public Point _z中心点;
29 public int _z帧数站 = 9;
30 public int _z帧数走 = 9;
31 public int _z帧数跑 = 9;
32 public int _z帧数杀 = 9;
33 public int _z帧数挡 = 9;
34 public int _z帧数挂 = 9;
35 public int _d当前动作 = 1;//1-6
36 public int _d当前动作最大帧数=8;
37 public int _cd;
38 public double _g攻击CD;
39 public int _x行 = 1;
40 public int _y列 = 1;
41 private int _zindex;
42 public int _Zindex
43 {
44 get { return _zindex; }
45 set { _zindex = value ; Canvas.SetZIndex(this, value ); }
46 }
47 private double _left;
48 public double Left
49 {
50 get { return _left; }
51 set { _left = value - _z中心点.X; Canvas.SetLeft(this, value - _z中心点.X); }
52 }
53 private double _top;
54 public double Top
55 {
56 get { return _top; }
57 set { _top = value - _z中心点.Y; Canvas.SetTop(this, value - _z中心点.Y); }
58 }
59 public SpritObject()
60 {
61 InitializeComponent();
62 lb名字.Width = Helper.oneside;
63 lb名字.Height = Helper.height名字;
64 lb名字.SetValue(Canvas.LeftProperty, 0d);
65 lb名字.SetValue(Canvas.TopProperty, 0d);
66 lb称号.Width = Helper.oneside;
67 lb称号.Height = Helper.height称号;
68 lb称号.SetValue(Canvas.LeftProperty, 0d);
69 lb称号.SetValue(Canvas.TopProperty, Helper.height名字);
70 imgBoyd.Width = Helper.oneside;
71 imgBoyd.Height = Helper.oneside;
72 imgBoyd.SetValue(Canvas.LeftProperty, 0d);
73 imgBoyd.SetValue(Canvas.TopProperty, Helper.height称号 + Helper.height名字);
74 //<Image.Clip> <EllipseGeometry Center="91,142" RadiusX="91" RadiusY="142" />
75 //EllipseGeometry eg = new EllipseGeometry(new Point(128d, 128d), 100d, 100d);
76 //imgBoyd.Clip = eg;
77 this.Width = Helper.oneside;
78 layout.Height = Helper.oneside + Helper.height称号 + Helper.height名字;
79 layout.Width = Helper.oneside;
80 this.Height = Helper.oneside + Helper.height称号 + Helper.height名字;
81 }
82 }