版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、<p> C#程序設(shè)計(jì)實(shí)訓(xùn)報(bào)告</p><p><b> 題目:俄羅斯方塊</b></p><p> 專 業(yè)____計(jì)算機(jī)科學(xué)與技術(shù) _</p><p> 年級班別___ 計(jì)算機(jī)09-2班__ </p><p> 學(xué) 號 </p><p&g
2、t; 學(xué)生姓名_____ _______</p><p> 指導(dǎo)教師_ </p><p> 成 績 </p><p> 2012 年 1 月 </p><p><b> 目 錄</b></p>
3、<p> 一 系統(tǒng)設(shè)計(jì)要求3</p><p> 1.1 課題分析錯誤!未定義書簽。</p><p> 1.2 設(shè)計(jì)環(huán)境3</p><p> 1.3 設(shè)計(jì)思路3</p><p> 二 課題總體框架設(shè)計(jì)3</p><p> 2.1程序流程圖4</p><p>
4、2.2類的結(jié)構(gòu)圖5</p><p><b> 三 課題實(shí)現(xiàn)6</b></p><p> 3.1程序主界面6</p><p> 3.2 開始游戲界面6</p><p> 3.3 游戲結(jié)束界面7</p><p> 3.4 暫停游戲界面7</p><p>
5、 3.5使用說明界面…...………………………………………………8</p><p> 3.6 關(guān)鍵程序代碼8</p><p><b> 四 總結(jié)21</b></p><p> 4.1設(shè)計(jì)總結(jié)21</p><p> 4.2 設(shè)計(jì)體會22</p><p><b> 一、系統(tǒng)
6、設(shè)計(jì)要求</b></p><p><b> 課題分析</b></p><p> 本游戲系統(tǒng)是利用C#實(shí)現(xiàn)的, 是制作為我們所熟悉的非常簡單的俄羅斯方塊游戲,該系統(tǒng)能實(shí)現(xiàn)的具體功能如下:</p><p> 能簡便的開始游戲,游戲中的方塊的功能與日常我們所熟悉的游戲的功能一致,各種塊的設(shè)置也一致,包括方塊的旋轉(zhuǎn),加速下降,左右移動
7、,滿行消去,滿行消去自動加分,以及到頂游戲結(jié)束等功能;</p><p> 能夠通過對話框窗體說明各個(gè)功能的使用說明,以及一些其他功能。</p><p> 界面簡潔美觀,簡單易用。跟其他一般的游戲相差不大。</p><p><b> 設(shè)計(jì)環(huán)境</b></p><p> 本程序選擇Visual Studio 2010
8、作為實(shí)驗(yàn)環(huán)境。</p><p><b> 1.3 設(shè)計(jì)思路</b></p><p> 用面向?qū)ο蟮姆椒ǚ治鱿到y(tǒng)</p><p> 對于俄羅斯方塊的程序制作,我們可以定義一個(gè)或者幾個(gè)類,專門來描述俄羅斯方塊,在這個(gè)類中,包含與之相關(guān)的方法、屬性和字段,通過封裝,實(shí)現(xiàn)其業(yè)務(wù)邏輯。其中,每一個(gè)俄羅斯方塊都有相同的特征,由4個(gè)小正方形構(gòu)成,有旋轉(zhuǎn)
9、,左右移動,下落的動作,整行被填滿除去并計(jì)算分?jǐn)?shù)而構(gòu)成行的小正方體塊?;袎K的形狀類型有7種:田、一、L、倒L、Z、倒Z、上。</p><p> 在窗口中通過調(diào)用主窗體Form1當(dāng)中的菜單欄來設(shè)置游戲的開始、暫停、結(jié)束、重新開始以及推出程序。還可以通過其菜單中游戲說明選項(xiàng)來查看游戲各個(gè)鍵的使用說明,還可調(diào)用幫助菜單來查看版權(quán)說明。</p><p> 二、課題總體框架設(shè)計(jì)</p&g
10、t;<p> 2.1、 程序流程圖</p><p><b> 類的結(jié)構(gòu)圖</b></p><p><b> 三、課題實(shí)現(xiàn)</b></p><p><b> 3.1程序主界面</b></p><p> 3.2 開始游戲界面</p><p
11、><b> 3.3游戲結(jié)束</b></p><p><b> 3.4暫停游戲</b></p><p> 3.5使用說明界面和版權(quán)界面</p><p><b> 3.6關(guān)鍵程序代碼</b></p><p><b> 1、Form1類</b>&
12、lt;/p><p> 構(gòu)造函數(shù),設(shè)定當(dāng)前運(yùn)行的方塊,下一個(gè)即將出現(xiàn)的方塊,方塊產(chǎn)生的位置,玩家積分,游戲開關(guān)等。</p><p> public partial class Form1 : Form</p><p><b> {</b></p><p> private Block currentBlock; //當(dāng)
13、前在運(yùn)行的方塊</p><p> private Block nextBlock; //下一個(gè)即將出現(xiàn)的方塊</p><p> private Point startLocation = new Point(bianjie.SingleSquareSize * 8, 0); //方塊產(chǎn)生的位置</p><p> private int score = 0
14、; //玩家積分</p><p> private bool stillRuning = false; //游戲運(yùn)行開關(guān)</p><p> 鍵盤操作:用來選擇方塊的移動方向,是向右移動,向左移動,向下加速,旋轉(zhuǎn),還是暫停。</p><p><b> /*鍵盤操作*/</b></p><p>
15、 private void Form1_KeyDown(object sender, KeyEventArgs e)</p><p><b> {</b></p><p> switch (e.KeyCode)</p><p><b> {</b></p><p> case Keys.Ri
16、ght: currentBlock.right() ; break;//向右移動</p><p> case Keys.Left: currentBlock.left() ; break; //向左移動</p><p> case Keys.Up: currentBlock.Rotate(); break; //旋轉(zhuǎn)</p><p> case Keys.
17、Down: while (currentBlock.down()) ; break; //向下加速</p><p> case Keys.Space: //空格:暫停</p><p> timer1.Enabled = !timer1.Enabled;</p><p> if (!timer1.Enabled
18、)</p><p> showMsg("暫 停");</p><p> else msg.SendToBack(); break; </p><p><b> }</b></p><p> picBack.Focus();</p><p><b>
19、 }</b></p><p> 時(shí)鐘觸發(fā)處理函數(shù),使方塊自動的向下移動,每1秒使方塊向下移動一次</p><p><b> /*游戲時(shí)鐘*/</b></p><p> private void timer1_Tick(object sender, EventArgs e)</p><p><b&
20、gt; {</b></p><p> if (!stillRuning)</p><p><b> return;</b></p><p> //檢測是否還可以下移</p><p> if (!currentBlock.down())</p><p><b> {
21、</b></p><p> if (currentBlock.Top() == 0)</p><p> {//如果到頂則游戲結(jié)束</p><p> showMsg("Game Over!");</p><p> stillRuning = false;</p><p> tim
22、er1.Stop();</p><p><b> return;</b></p><p><b> }</b></p><p> //否則計(jì)算分?jǐn)?shù)并繼續(xù)</p><p> int eraseLines = bianjie.CheckLines();</p><p>
23、 if (eraseLines > 0)</p><p><b> {</b></p><p> score += bianjie.width * eraseLines;</p><p> t_score.Text = score.ToString();</p><p> picBack.Invalidat
24、e();</p><p> Application.DoEvents();</p><p> bianjie.Redraw();</p><p><b> }</b></p><p> //產(chǎn)生下一個(gè)block</p><p> currentBlock = new Block(star
25、tLocation, nextBlock.blockType);</p><p> currentBlock.Draw(bianjie.winHandle);</p><p> pic_preView.Refresh();</p><p> nextBlock = new Block(new Point(50, 50), Block.BlockTypes.un
26、defined);</p><p> nextBlock.Draw(pic_preView.Handle);</p><p><b> }</b></p><p> currentBlock.down();</p><p><b> }</b></p><p> 4
27、) 對窗口進(jìn)行重繪 </p><p><b> /*窗口重繪*/</b></p><p> private void Form1_Activated(object sender, EventArgs e)</p><p><b> {</b></p><p> picBack.I
28、nvalidate();</p><p> Application.DoEvents();</p><p> bianjie.Redraw();</p><p><b> }</b></p><p> 2、SingleBlock類</p><p> 1) 構(gòu)造單個(gè)方塊的尺寸,顏色,前景色
29、,背景色</p><p> public SingleBlock(Size initSize,Color initForeColor,Color initBackColor)</p><p><b> {</b></p><p> size = initSize;</p><p> foreColor = ini
30、tForeColor;</p><p> backColor = initBackColor;</p><p><b> }</b></p><p> 2) 畫方塊,用GDI+繪畫,畫出填充正方形 </p><p><b> //畫方塊</b></p><p>
31、 public void Draw(System.IntPtr winHandle)</p><p><b> {</b></p><p> Graphics g = Graphics.FromHwnd(winHandle);</p><p> GraphicsPath gp = new GraphicsPath();</p>
32、;<p> Rectangle rect = new Rectangle(location, size);</p><p> gp.AddRectangle(rect);</p><p> Color[] surroundColor = new Color[] { backColor };</p><p> PathGradientBrush
33、pgb = new PathGradientBrush(gp);</p><p> pgb.CenterColor = foreColor;</p><p> pgb.SurroundColors = surroundColor;</p><p> g.FillPath(pgb, gp);</p><p><b> }<
34、;/b></p><p><b> //擦除方塊</b></p><p> public void Erase(System.IntPtr winHandle)</p><p><b> {</b></p><p> Graphics g = Graphics.FromHwnd(win
35、Handle);</p><p> Rectangle rect = new Rectangle(location,size);</p><p> g.FillRectangle(new SolidBrush(bianjie.BackColor),rect);</p><p><b> }</b></p><p>
36、<b> 3、Block類</b></p><p> 1)隨機(jī)產(chǎn)生方塊形狀,并設(shè)置四個(gè)方塊的顏色</p><p> public Block(Point thisLocation,BlockTypes bType)</p><p> { //當(dāng)blockType為undefined時(shí),隨機(jī)產(chǎn)生方塊形狀</p><p&
37、gt; Random rand=new Random();</p><p> if (bType == BlockTypes.undefined)</p><p><b> {</b></p><p> blockType = (BlockTypes)(rand.Next(7) + 1);</p><p><
38、;b> }</b></p><p><b> else</b></p><p> blockType = bType;</p><p> //設(shè)置四小方塊的顏色</p><p> int i=(int)blockType-1;</p><p> foreColor =
39、 bianjie.BlockForeColor[i];</p><p> backColor = bianjie.BlockBackColor[i];</p><p> Size SingleSquareS=new Size(SingleSquareSize,SingleSquareSize);</p><p> SingleSquare1 = new Sin
40、gleBlock(SingleSquareS, foreColor, backColor);</p><p> SingleSquare2 = new SingleBlock(SingleSquareS, foreColor, backColor);</p><p> SingleSquare3 = new SingleBlock(SingleSquareS, foreColor, b
41、ackColor);</p><p> SingleSquare4 = new SingleBlock(SingleSquareS, foreColor, backColor);</p><p> 2)設(shè)置小方塊的位置,組合成指定形狀的方塊</p><p> //設(shè)置小方塊的位置,組合成指定形狀的一個(gè)大方塊</p><p> swit
42、ch (blockType)</p><p><b> {</b></p><p> case BlockTypes.SingleSquare:</p><p><b> //組合成正方形</b></p><p> SingleSquare1.location = new Point(thi
43、sLocation.X, thisLocation.Y);</p><p> SingleSquare2.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y);</p><p> SingleSquare3.location = new Point(thisLocation.X,thisLocat
44、ion.Y+SingleSquareSize);</p><p> SingleSquare4.location = new Point(thisLocation.X+SingleSquareSize,thisLocation.Y+SingleSquareSize);</p><p><b> break;</b></p><p> ca
45、se BlockTypes.line:</p><p><b> //組合成線形</b></p><p> SingleSquare1.location = new Point(thisLocation.X, thisLocation.Y);</p><p> SingleSquare2.location = new Point(this
46、Location.X + SingleSquareSize, thisLocation.Y);</p><p> SingleSquare3.location = new Point(thisLocation.X + 2 * SingleSquareSize, thisLocation.Y);</p><p> SingleSquare4.location = new Point(th
47、isLocation.X + 3 * SingleSquareSize, thisLocation.Y);</p><p><b> break;</b></p><p> case BlockTypes.J:</p><p><b> //組合成J形</b></p><p> Single
48、Square1.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y);</p><p> SingleSquare2.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y + SingleSquareSize);</p>
49、<p> SingleSquare3.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y + 2 * SingleSquareSize);</p><p> SingleSquare4.location = new Point(thisLocation.X, thisLocation.Y + 2 * Singl
50、eSquareSize);</p><p><b> break;</b></p><p> case BlockTypes.L:</p><p><b> //組合成l形</b></p><p> SingleSquare1.location = new Point(thisLocatio
51、n.X, thisLocation.Y);</p><p> SingleSquare2.location = new Point(thisLocation.X, thisLocation.Y + SingleSquareSize);</p><p> SingleSquare3.location = new Point(thisLocation.X, thisLocation.Y +
52、 2 * SingleSquareSize);</p><p> SingleSquare4.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y + 2 * SingleSquareSize);</p><p><b> break;</b></p><p
53、> case BlockTypes.T:</p><p><b> //組合成T形</b></p><p> SingleSquare1.location = new Point(thisLocation.X, thisLocation.Y);</p><p> SingleSquare2.location = new Point
54、(thisLocation.X + SingleSquareSize, thisLocation.Y);</p><p> SingleSquare3.location = new Point(thisLocation.X + 2*SingleSquareSize, thisLocation.Y);</p><p> SingleSquare4.location = new Point
55、(thisLocation.X + SingleSquareSize, thisLocation.Y +SingleSquareSize);</p><p><b> break;</b></p><p> case BlockTypes.Z:</p><p><b> //組合成z形</b></p>
56、<p> SingleSquare1.location = new Point(thisLocation.X, thisLocation.Y);</p><p> SingleSquare2.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y);</p><p> SingleSqua
57、re3.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y + SingleSquareSize);</p><p> SingleSquare4.location = new Point(thisLocation.X + 2*SingleSquareSize, thisLocation.Y + SingleSquareS
58、ize);</p><p><b> break;</b></p><p> case BlockTypes.S:</p><p><b> //組合成S形</b></p><p> SingleSquare1.location = new Point(thisLocation.X, thi
59、sLocation.Y + SingleSquareSize);</p><p> SingleSquare2.location = new Point(thisLocation.X + SingleSquareSize, thisLocation.Y + SingleSquareSize);</p><p> SingleSquare3.location = new Point(th
60、isLocation.X + SingleSquareSize, thisLocation.Y);</p><p> SingleSquare4.location = new Point(thisLocation.X + 2 * SingleSquareSize, thisLocation.Y);</p><p><b> break;</b></p>
61、<p><b> }</b></p><p><b> }</b></p><p><b> /*畫方塊*/</b></p><p> public void Draw(System.IntPtr winHandle)</p><p><b>
62、 {</b></p><p> SingleSquare1.Draw(winHandle);</p><p> SingleSquare2.Draw(winHandle);</p><p> SingleSquare3.Draw(winHandle);</p><p> SingleSquare4.Draw(winHand
63、le);</p><p><b> }</b></p><p><b> /*擦方塊*/</b></p><p> public void Erase(System.IntPtr winHandle)</p><p><b> {</b></p><
64、p> SingleSquare1.Erase(winHandle);</p><p> SingleSquare2.Erase(winHandle);</p><p> SingleSquare3.Erase(winHandle);</p><p> SingleSquare4.Erase(winHandle);</p><p>
65、;<b> }</b></p><p><b> 3) 移動方塊</b></p><p><b> /*移動*/</b></p><p> public bool down()</p><p><b> {</b></p><
66、p> //檢測是否可以下移</p><p> if (bianjie.isEmpty(SingleSquare1.location.X / SingleSquareSize, SingleSquare1.location.Y / SingleSquareSize + 1) &&</p><p> bianjie.isEmpty(SingleSquare2.loc
67、ation.X / SingleSquareSize, SingleSquare2.location.Y / SingleSquareSize + 1) &&</p><p> bianjie.isEmpty(SingleSquare3.location.X / SingleSquareSize, SingleSquare3.location.Y / SingleSquareSize + 1)
68、&&</p><p> bianjie.isEmpty(SingleSquare4.location.X / SingleSquareSize, SingleSquare4.location.Y / SingleSquareSize + 1))</p><p><b> {</b></p><p> Erase(bianj
69、ie.winHandle);</p><p> SingleSquare1.location = new Point(SingleSquare1.location.X, SingleSquare1.location.Y + SingleSquareSize);</p><p> SingleSquare2.location = new Point(SingleSquare2.locat
70、ion.X, SingleSquare2.location.Y + SingleSquareSize);</p><p> SingleSquare3.location = new Point(SingleSquare3.location.X, SingleSquare3.location.Y + SingleSquareSize);</p><p> SingleSquare4.lo
71、cation = new Point(SingleSquare4.location.X, SingleSquare4.location.Y + SingleSquareSize);</p><p> Draw(bianjie.winHandle);</p><p> return true;</p><p><b> }</b></
72、p><p> else //如果不能下移了</p><p><b> {</b></p><p> bianjie.stopSingleSquare(SingleSquare1, SingleSquare1.location.X / SingleSquareSize, SingleSquare1.location.Y / SingleSqu
73、areSize);</p><p> bianjie.stopSingleSquare(SingleSquare2, SingleSquare2.location.X / SingleSquareSize, SingleSquare2.location.Y / SingleSquareSize);</p><p> bianjie.stopSingleSquare(SingleSqua
74、re3, SingleSquare3.location.X / SingleSquareSize, SingleSquare3.location.Y / SingleSquareSize);</p><p> bianjie.stopSingleSquare(SingleSquare4, SingleSquare4.location.X / SingleSquareSize, SingleSquare4.loc
75、ation.Y / SingleSquareSize);</p><p> return false; //表示可以彈出下一個(gè)block了</p><p><b> }</b></p><p><b> }</b></p><p> public bool left()</p>
76、<p><b> {</b></p><p> //檢測是否可以左移</p><p> if (bianjie.isEmpty(SingleSquare1.location.X / SingleSquareSize-1, SingleSquare1.location.Y / SingleSquareSize) &&</p>
77、<p> bianjie.isEmpty(SingleSquare2.location.X / SingleSquareSize-1, SingleSquare2.location.Y / SingleSquareSize) &&</p><p> bianjie.isEmpty(SingleSquare3.location.X / SingleSquareSize-1, Sin
78、gleSquare3.location.Y / SingleSquareSize) &&</p><p> bianjie.isEmpty(SingleSquare4.location.X / SingleSquareSize-1, SingleSquare4.location.Y / SingleSquareSize))</p><p><b> {<
79、/b></p><p> Erase(bianjie.winHandle);</p><p> SingleSquare1.location = new Point(SingleSquare1.location.X - SingleSquareSize, SingleSquare1.location.Y);</p><p> SingleSquare2.
80、location = new Point(SingleSquare2.location.X - SingleSquareSize, SingleSquare2.location.Y);</p><p> SingleSquare3.location = new Point(SingleSquare3.location.X - SingleSquareSize, SingleSquare3.location.Y)
81、;</p><p> SingleSquare4.location = new Point(SingleSquare4.location.X - SingleSquareSize, SingleSquare4.location.Y);</p><p> Draw(bianjie.winHandle);</p><p> return true;</p&g
82、t;<p><b> }</b></p><p> else //如果不能左移了</p><p><b> {</b></p><p> return false; </p><p><b> }</b></p><p><
83、;b> }</b></p><p> public bool right()</p><p><b> {</b></p><p> //檢測是否可以右移</p><p> if (bianjie.isEmpty(SingleSquare1.location.X / SingleSquareS
84、ize +1, SingleSquare1.location.Y / SingleSquareSize) &&</p><p> bianjie.isEmpty(SingleSquare2.location.X / SingleSquareSize +1, SingleSquare2.location.Y / SingleSquareSize) &&</p><
85、;p> bianjie.isEmpty(SingleSquare3.location.X / SingleSquareSize +1, SingleSquare3.location.Y / SingleSquareSize) &&</p><p> bianjie.isEmpty(SingleSquare4.location.X / SingleSquareSize +1, Single
86、Square4.location.Y / SingleSquareSize))</p><p><b> {</b></p><p> Erase(bianjie.winHandle);</p><p> SingleSquare1.location = new Point(SingleSquare1.location.X + Singl
87、eSquareSize, SingleSquare1.location.Y );</p><p> SingleSquare2.location = new Point(SingleSquare2.location.X + SingleSquareSize, SingleSquare2.location.Y);</p><p> SingleSquare3.location = new
88、 Point(SingleSquare3.location.X + SingleSquareSize, SingleSquare3.location.Y);</p><p> SingleSquare4.location = new Point(SingleSquare4.location.X + SingleSquareSize, SingleSquare4.location.Y);</p>&
89、lt;p> Draw(bianjie.winHandle);</p><p> return true;</p><p><b> }</b></p><p> else //如果不能右移了</p><p><b> {</b></p><p> retu
90、rn false; </p><p><b> }</b></p><p><b> }</b></p><p><b> 4) 旋轉(zhuǎn)方塊</b></p><p> /*旋轉(zhuǎn)block*/</p><p> public void Rotate
91、()</p><p><b> {</b></p><p> //保存每個(gè)小塊的位置</p><p> Point oldPosition1 = SingleSquare1.location;</p><p> Point oldPosition2 = SingleSquare2.location;</p&
92、gt;<p> Point oldPosition3 = SingleSquare3.location;</p><p> Point oldPosition4 = SingleSquare4.location;</p><p><b> //保存當(dāng)前的方向</b></p><p> RotateDirections ol
93、dRotation = myRotation;</p><p> //開始試著旋轉(zhuǎn)方塊,旋轉(zhuǎn)方向:順時(shí)針方向 旋轉(zhuǎn)中心點(diǎn)為形狀拐點(diǎn)</p><p> Erase(bianjie.winHandle);</p><p> switch(blockType)</p><p><b> {</b></p>
94、<p> case BlockTypes.SingleSquare: break;</p><p> case BlockTypes.line:</p><p> //直線的旋轉(zhuǎn)只有兩種方向</p><p> switch (myRotation)</p><p><b> {</b></p
95、><p> case RotateDirections.North:</p><p> myRotation = RotateDirections.East;</p><p> SingleSquare1.location = new Point(SingleSquare2.location.X-SingleSquareSize,SingleSquare2.loc
96、ation.Y);</p><p> SingleSquare3.location = new Point(SingleSquare2.location.X+SingleSquareSize,SingleSquare2.location.Y);</p><p> SingleSquare4.location = new Point(SingleSquare2.location.X +
97、2 * SingleSquareSize, SingleSquare2.location.Y);</p><p><b> break;</b></p><p> case RotateDirections.East:</p><p> myRotation = RotateDirections.North;</p><
98、;p> SingleSquare1.location = new Point(SingleSquare2.location.X,SingleSquare2.location.Y-SingleSquareSize);</p><p> SingleSquare3.location = new Point(SingleSquare2.location.X, SingleSquare2.location.Y
99、+SingleSquareSize);</p><p> SingleSquare4.location = new Point(SingleSquare2.location.X, SingleSquare2.location.Y + 2 * SingleSquareSize);</p><p><b> break;</b></p><p>
100、;<b> }</b></p><p><b> break;</b></p><p> case BlockTypes.J:</p><p> //J形方塊有四種旋轉(zhuǎn)方向</p><p> switch (myRotation)</p><p><b>
101、 {</b></p><p> case RotateDirections.North:</p><p> myRotation = RotateDirections.East;</p><p> SingleSquare1.location = new Point(SingleSquare3.location.X+2*SingleSquareS
102、ize,SingleSquare3.location.Y);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X+SingleSquareSize,SingleSquare3.location.Y);</p><p> SingleSquare4.location = new Point(Single
103、Square3.location.X,SingleSquare3.location.Y-SingleSquareSize);</p><p><b> break;</b></p><p> case RotateDirections.East:</p><p> myRotation = RotateDirections.South;&
104、lt;/p><p> SingleSquare1.location = new Point(SingleSquare3.location.X,SingleSquare3.location.Y+2*SingleSquareSize);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X,SingleSqua
105、re3.location.Y+SingleSquareSize);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X+SingleSquareSize,SingleSquare3.location.Y);</p><p><b> break;</b></p>&
106、lt;p> case RotateDirections.South:</p><p> myRotation = RotateDirections.West;</p><p> SingleSquare1.location = new Point(SingleSquare3.location.X-2*SingleSquareSize,SingleSquare3.location
107、.Y);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X-SingleSquareSize,SingleSquare3.location.Y);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X,SingleS
108、quare3.location.Y+SingleSquareSize);</p><p><b> break;</b></p><p> case RotateDirections.West:</p><p> myRotation = RotateDirections.North;</p><p> Sing
109、leSquare1.location = new Point(SingleSquare3.location.X,SingleSquare3.location.Y-2*SingleSquareSize);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X,SingleSquare3.location.Y-SingleSquar
110、eSize);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X-SingleSquareSize,SingleSquare3.location.Y);</p><p><b> break;</b></p><p><b> }</b
111、></p><p><b> break;</b></p><p> case BlockTypes.L:</p><p> //L形方塊有四種旋轉(zhuǎn)方向</p><p> switch (myRotation)</p><p><b> {</b></p
112、><p> case RotateDirections.North:</p><p> myRotation = RotateDirections.East;</p><p> SingleSquare1.location = new Point(SingleSquare3.location.X+2*SingleSquareSize,SingleSquare3.l
113、ocation.Y);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X+SingleSquareSize, SingleSquare3.location.Y);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X
114、, SingleSquare3.location.Y+SingleSquareSize);</p><p><b> break;</b></p><p> case RotateDirections.East:</p><p> myRotation = RotateDirections.South;</p><p&
115、gt; SingleSquare1.location = new Point(SingleSquare3.location.X, SingleSquare3.location.Y + 2 * SingleSquareSize);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X, SingleSquare3.locatio
116、n.Y + SingleSquareSize);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X - SingleSquareSize, SingleSquare3.location.Y);</p><p><b> break;</b></p><p&g
117、t; case RotateDirections.South:</p><p> myRotation = RotateDirections.West;</p><p> SingleSquare1.location = new Point(SingleSquare3.location.X - 2 * SingleSquareSize, SingleSquare3.location.
118、Y);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X - SingleSquareSize, SingleSquare3.location.Y);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X, Sing
119、leSquare3.location.Y - SingleSquareSize);</p><p><b> break;</b></p><p> case RotateDirections.West:</p><p> myRotation = RotateDirections.North;</p><p>
120、 SingleSquare1.location = new Point(SingleSquare3.location.X, SingleSquare3.location.Y - 2 * SingleSquareSize);</p><p> SingleSquare2.location = new Point(SingleSquare3.location.X, SingleSquare3.location.Y
121、- SingleSquareSize);</p><p> SingleSquare4.location = new Point(SingleSquare3.location.X + SingleSquareSize, SingleSquare3.location.Y);</p><p><b> break;</b></p><p>&l
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 俄羅斯方塊課程設(shè)計(jì)-- 用c++實(shí)現(xiàn)的俄羅斯方塊程序設(shè)計(jì)
- c#俄羅斯方塊課程設(shè)計(jì)
- 《c++俄羅斯方塊》課程設(shè)計(jì)--俄羅斯方塊
- 畢業(yè)設(shè)計(jì)---俄羅斯方塊游戲程序設(shè)計(jì)
- 基于c程序的俄羅斯方塊游戲設(shè)計(jì)
- c語言課程設(shè)計(jì)報(bào)告-俄羅斯方塊
- c課程設(shè)計(jì)--俄羅斯方塊
- 俄羅斯方塊c++課程設(shè)計(jì)報(bào)告
- 俄羅斯方塊
- 俄羅斯方塊課程設(shè)計(jì)報(bào)告
- c_課程設(shè)計(jì)-俄羅斯方塊
- c++俄羅斯方塊課程設(shè)計(jì)
- c++俄羅斯方塊課程設(shè)計(jì)
- 俄羅斯方塊課程設(shè)計(jì)報(bào)告
- 課程設(shè)計(jì)--用vc++實(shí)現(xiàn)俄羅斯方塊的程序設(shè)計(jì)
- 課程設(shè)計(jì)---用vc++實(shí)現(xiàn)俄羅斯方塊的程序設(shè)計(jì)
- 課程設(shè)計(jì)--俄羅斯方塊設(shè)計(jì)報(bào)告
- 俄羅斯方塊論文
- 俄羅斯方塊項(xiàng)目
- c++俄羅斯方塊課程設(shè)計(jì)報(bào)告書
評論
0/150
提交評論