資源簡介
head first c#最后一個實驗,入侵者游戲源碼

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Threading;
namespace?入侵者
{
????public?partial?class?Form1?:?Form
????{
????????private?Game?game;
????????private?int?animationCell?=?0;
????????private?int?frame?=?0;
????????public?Form1()
????????{
????????????InitializeComponent();
????????????newGame();
????????}
????????private?void?game_GameOver(object?sender?EventArgs?e)
????????{
????????????animationTimer.Stop();
????????????gameTimer.Stop();
????????????this.Invalidate();
????????}
????????private?void?animationTimer_Tick(object?sender?EventArgs?e)
????????{
????????????frame++;
????????????if?(frame?>?5)
????????????????frame?=0;
????????????switch?(frame)
????????????{
????????????????case?0:?animationCell?=?0;?break;
????????????????case?1:?animationCell?=?1;?break;
????????????????case?2:?animationCell?=?2;?break;
????????????????case?3:?animationCell?=?3;?break;
????????????????case?4:?animationCell?=?2;?break;
????????????????case?5:?animationCell?=?1;?break;
????????????????default:?animationCell?=?0;?break;
????????????}?????????
????????????this.Invalidate();
????????}
????????private?void?Form1_Paint(object?sender?PaintEventArgs?e)
????????{
????????????game.Draw(e.Graphics?animationCell);
????????????game.Twinkle();
????????}
????????private?void?newGame()
????????{
????????????game?=?new?Game(this);
????????????game.NewLevel();
????????????animationTimer.Start();
????????????gameTimer.Start();
????????????game.GameOver?+=?new?EventHandler(game_GameOver);?????????
????????}
????????private?void?gameTimer_Tick(object?sender?EventArgs?e)
????????{
????????????game.Go();
????????}
????????protected?override?bool?ProcessCmdKey(ref?Message?msg?Keys?keyData)
????????{
????????????switch?(keyData)
????????????{??????????????
????????????????case?Keys.Left:
????????????????????game.MovePlayer(Direction.Left);
????????????????????break;
????????????????case?Keys.Right:
????????????????????game.MovePlayer(Direction.Right);
????????????????????break;???????
????????????????case?Keys.Space:
????????????????????game.FileShot();
????????????????????break;
????????????????case?Keys.S:
????????????????????newGame();
????????????????????break;
????????????????case?Keys.Q:
????????????????????this.Close();
????????????????????break;
????????????????default:
????????????????????break;
????????????}
????????????return?true;
????????}
????}
????public?enum?Direction
????{
????????Left
????????Right
????????Up
????????Down
????}
????public?class?Game
????{
????????private?Form1?form;
????????private?int?score?=?0;//游戲分數
????????private?int?livesLeft?=?2;//玩家姓名
????????private?int?wave?=?0;//怪物波數
????????private?int?framesSkipped?=?20;//怪物移動等待幀數
????????private?int?frame;
????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1374??2013-05-21?09:30??入侵者\Properties\AssemblyInfo.cs
?????文件??????12359??2013-05-21?10:38??入侵者\Properties\Resources.resx
?????文件???????9492??2013-05-21?10:38??入侵者\Properties\Resources.Designer.cs
?????文件????????249??2013-05-21?09:30??入侵者\Properties\Settings.settings
?????文件???????1094??2013-05-21?09:30??入侵者\Properties\Settings.Designer.cs
?????文件??????24053??2013-05-26?14:38??入侵者\Form1.cs
?????文件???????2549??2013-05-22?20:19??入侵者\Form1.Designer.cs
?????文件????????490??2013-05-21?09:30??入侵者\Program.cs
?????文件???????5638??2013-05-21?11:18??入侵者\入侵者.csproj
?????文件????????490??2010-03-17?22:39??入侵者\bin\Debug\入侵者.vshost.exe.manifest
?????文件??????11608??2013-05-26?14:34??入侵者\bin\Debug\入侵者.vshost.exe
?????文件??????44544??2013-05-26?14:31??入侵者\bin\Debug\入侵者.exe
?????文件??????60928??2013-05-26?14:31??入侵者\bin\Debug\入侵者.pdb
?????文件???????7680??2013-05-21?10:38??入侵者\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????7319??2013-05-26?14:31??入侵者\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????180??2013-05-22?20:19??入侵者\obj\x86\Debug\入侵者.Form1.resources
?????文件??????20243??2013-05-21?11:18??入侵者\obj\x86\Debug\入侵者.Properties.Resources.resources
?????文件???????2718??2013-05-22?20:19??入侵者\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog
?????文件????????386??2013-05-22?20:19??入侵者\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog
?????文件??????????2??2013-05-22?20:19??入侵者\obj\x86\Debug\GenerateResource-ResGen.read.4.tlog
?????文件????????635??2013-05-26?14:34??入侵者\obj\x86\Debug\入侵者.csproj.FileListAbsolute.txt
?????文件??????44544??2013-05-26?14:31??入侵者\obj\x86\Debug\入侵者.exe
?????文件??????60928??2013-05-26?14:31??入侵者\obj\x86\Debug\入侵者.pdb
?????文件???????6217??2013-05-22?20:19??入侵者\Form1.resx
?????文件????????338??2013-05-21?10:24??入侵者\Resources\block.png
?????文件???????1111??2013-05-21?10:24??入侵者\Resources\bug1.png
?????文件????????349??2013-05-21?10:24??入侵者\Resources\bug2.png
?????文件????????337??2013-05-21?10:24??入侵者\Resources\bug3.png
?????文件????????349??2013-05-21?10:24??入侵者\Resources\bug4.png
?????文件???????3193??2013-05-21?10:24??入侵者\Resources\flyingsaucer1.png
............此處省略32個文件信息
- 上一篇:C# IC卡讀寫源碼(純代碼,無封裝)
- 下一篇:c#影院售票系統(含數據庫)
評論
共有 條評論