欢迎来到天天文库
浏览记录
ID:39889897
大小:42.50 KB
页数:9页
时间:2019-07-14
《vb小游戏制作》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Vb制作小游戏一、射击游戏OptionExplicitDimRandXAsSingleDimRandYAsSingleDimScoreAsSingleDimThisscoreAsSingleDimAverageAsSingleDimShotAsIntegerDimAppearAsBooleanDimDistanceAsSinglePrivateSubCommand1_Click()Timer1.Enabled=TrueCommand3.Enabled=TrueIfCommand1.Enabled=TrueThenCommand3.Caption="暂停"EndIfComman
2、d4.Enabled=TrueEndSubPrivateSubCommand2_Click()IfCommand4.Enabled=TrueThenMsgBox"请先结束游戏",48,"警告"Vb制作小游戏一、射击游戏OptionExplicitDimRandXAsSingleDimRandYAsSingleDimScoreAsSingleDimThisscoreAsSingleDimAverageAsSingleDimShotAsIntegerDimAppearAsBooleanDimDistanceAsSinglePrivateSubCommand1_Click()Tim
3、er1.Enabled=TrueCommand3.Enabled=TrueIfCommand1.Enabled=TrueThenCommand3.Caption="暂停"EndIfCommand4.Enabled=TrueEndSubPrivateSubCommand2_Click()IfCommand4.Enabled=TrueThenMsgBox"请先结束游戏",48,"警告"Vb制作小游戏一、射击游戏OptionExplicitDimRandXAsSingleDimRandYAsSingleDimScoreAsSingleDimThisscoreAsSingleDimA
4、verageAsSingleDimShotAsIntegerDimAppearAsBooleanDimDistanceAsSinglePrivateSubCommand1_Click()Timer1.Enabled=TrueCommand3.Enabled=TrueIfCommand1.Enabled=TrueThenCommand3.Caption="暂停"EndIfCommand4.Enabled=TrueEndSubPrivateSubCommand2_Click()IfCommand4.Enabled=TrueThenMsgBox"请先结束游戏",48,"警告"Els
5、eEndEndIfEndSubPrivateSubCommand3_Click()Command1.Enabled=FalseCommand3.Caption="继续"Timer1.Enabled=NotTimer1.EnabledIfTimer1.Enabled=TrueThenCommand3.Caption="暂停"EndIfEndSubPrivateSubCommand4_Click()Timer1.Enabled=FalseCommand3.Enabled=FalseCommand1.Enabled=TruePicture1.ClsLabel1.Caption="射
6、击:"Label2.Caption="平均得分:"Label3.Caption="环数:"Label4.Caption="总分:"Command4.Enabled=FalseCommand3.Caption="暂停"EndSubPrivateSubForm_Load()Appear=FalseTimer1.Enabled=FalseThisscore=0Score=0Shot=0EndSubPrivateSubPicture1_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)BeepShot=Shot+
7、1Picture1.DrawWidth=4Picture1.PSet(X,Y),RGB(255,0,0)Distance=Sqr((X-RandX)*(X-RandX)+(Y-RandY)*(Y-RandY))IfAppearAndTimer1.EnabledThenThisscore=5-Int(Distance/10)IfThisscore<=0ThenThisscore=0EndIfScore=Score+ThisscoreAverage=Int((Score/Shot)*100)/100Labe
此文档下载收益归作者所有