樱花视频在线观看-西西人体大胆4444ww张筱雨-久久网免费视频-国产99页-91高清视频在线-日日干夜夜干-91社区视频-中文高清av-久久成人国产-亚洲日韩欧洲乱码av夜夜摸-97人人射-亚洲视频观看-理论片亚洲-亚洲精品99999-免费能看的黄色片-精人妻无码一区二区三区-奇米影视播放器

游戲產(chǎn)業(yè)研究網(wǎng)

vb 聲音代碼 除了beep還有別的么?我寫了一個(gè)射擊游戲的程序,想要一個(gè)特別的聲音。不要api,簡單的。

一、vb 聲音代碼 除了beep還有別的么?我寫了一個(gè)射擊游戲的程序,想要一個(gè)特別的聲音。不要api,簡單的。

VB 內(nèi)置聲音就只有Beep() .建議你用API 吧,畢竟游戲程序是不能缺少真實(shí)的聲音的(至少用戶會(huì)覺得你很用心去設(shè)計(jì)它)..

二、額~~嘿 VB 不懂的地方

。。。?;謴?fù)到初始狀態(tài)得看你的“初始狀態(tài)”是怎樣

btnStart.enabled=true 是讓那個(gè)按鈕可以被用戶按下

如果用戶按下這個(gè)按鈕就可以了,那么這樣

btnStart_click

應(yīng)該就是了

三、求VB設(shè)計(jì)的小游戲 代碼

打地鼠好做一點(diǎn):

窗體上放上背景圖,控件放二個(gè)Label,一個(gè)顯示分?jǐn)?shù)及升級(jí)分?jǐn)?shù),另一個(gè)顯示時(shí)間;一個(gè)Image顯示地鼠圖形(要透明背景);一個(gè)Timer控制時(shí)間顯示;另外將窗體的鼠標(biāo)設(shè)置為錘子。

在Image的單擊事件中分值增加就好了。

四、vb 打冰雹游戲

'新建窗體,添加picture1,timer1,label1,option1(0-3)

’以下保存在模塊module1.bas中:

public type stdball

ox as integer

oy as integer

ballcolor as colorconstants

speed as integer

end type

public type stdspark

posx as integer

posy as integer

angle as integer

sparkcolor as colorconstants

speed as integer

size as integer

end type

public type stdsparks

ox as integer

oy as integer

spark(9) as stdspark

end type

'以下保存在窗體代碼中:

dim ball(9) as stdball, sparks(9) as stdsparks, x0 as single, y0 as single

const pi = 3.14159265

private sub form_load()

initialgame 2, 1

end sub

private sub picture1_mousedown(button as integer, shift as integer, x as single, y as single)

for i = 0 to 9

if (x - ball(i).ox) ^ 2 + (y - ball(i).oy) ^ 2 < 400 then

initialspark i

initialball i

label1.tag = split(label1.tag, *)(0) + 1 & * & split(label1.tag, *)(1)

label1.caption = 分?jǐn)?shù): & split(label1.tag, *)(0) & vbcrlf & 能量: & split(label1.tag, *)(1)

if split(label1.tag, *)(0) = 25 then msgbox 好樣的,繼續(xù)努力!

if split(label1.tag, *)(0) = 50 then msgbox 太棒了,再射中50個(gè)你就過關(guān)了,努力啊!

if split(label1.tag, *)(0) = 100 then

msgbox 恭喜你過關(guān)了,增加難度,再繼續(xù)!

initialgame 3, 0

end if

if split(label1.tag, *)(0) = 150 then initialgame 4, 0

exit sub

end if

next

if split(label1.tag, *)(0) > 0 then label1.tag = split(label1.tag, *)(0) - 1 & * & split(label1.tag, *)(1)

label1.caption = 分?jǐn)?shù): & split(label1.tag, *)(0) & vbcrlf & 能量: & split(label1.tag, *)(1)

end sub

private sub picture1_mousemove(button as integer, shift as integer, x as single, y as single)

x0 = x: y0 = y

end sub

private sub option1_click(index as integer)

initialgame index + 1, 0

end sub

private sub timer1_timer()

picture1.backcolor = picture1.backcolor

for i = 0 to 9

drawball i

drawspark i

next

end sub

sub initialball(byval index as integer) '初始化圓球

dim awx() as integer, n as integer '將游戲窗口picture1沿x軸等分15段(每段50),10個(gè)球隨機(jī)占用這15段,為保證每一段內(nèi)只有一個(gè)球,awx()用來存儲(chǔ)未被占用的斷的中點(diǎn)x(圓球球心)坐標(biāo)

for x = 0 to 14 '計(jì)算存儲(chǔ)未被占用的段

for i = 0 to 9

if ball(i).ox = x * 50 + 25 then exit for

next

if i = 10 then

redim preserve awx(n)

awx(n) = x * 50 + 25

n = n + 1

end if

next

ball(index).ox = awx(int(rnd * n)) '隨機(jī)選擇未被占用的段

ball(index).oy = int(rnd * (-100))

ball(index).speed = int(rnd * me.tag + 1) '下落速度

ball(index).ballcolor = qbcolor(int(rnd * 15)) '顏色

end sub

sub initialspark(byval index as integer) '初始化火花

sparks(index).ox = ball(index).ox '爆炸圓心

sparks(index).oy = ball(index).oy

for i = 0 to 9

sparks(index).spark(i).posx = ball(index).ox '火花位置

sparks(index).spark(i).posy = ball(index).oy

sparks(index).spark(i).angle = int(rnd * 361) * pi / 180 '角度

sparks(index).spark(i).sparkcolor = ball(index).ballcolor '顏色

sparks(index).spark(i).speed = int(rnd * 15 + 10) '速度

sparks(index).spark(i).size = int(rnd * 12 + 5) '大小

next

end sub

sub drawball(byval index as integer) '畫圓球

picture1.fillstyle = 0 '實(shí)體填充

picture1.fillcolor = ball(index).ballcolor '填充顏色

picture1.drawwidth = 1 '線寬1

ball(index).oy = ball(index).oy + ball(index).speed '計(jì)算圓球y軸位置

picture1.circle (ball(index).ox, ball(index).oy), 20, vbwhite

picture1.fillcolor = vbwhite '高光顏色

picture1.circle (ball(index).ox + 15 * cos((3625 - 2 * ball(index).oy) * pi / 2900), ball(index).oy - 15 * sin((3625 - 2 * ball(index).oy) * pi / 2900)), 3, vbwhite

picture1.drawwidth = 4

picture1.circle (ball(index).ox, ball(index).oy), 15, vbwhite, (2175 + ball(index).oy) * pi / 1450, ball(index).oy * pi / 1450 'pi * 3 / 2, 2 * pi

if (x0 - ball(index).ox) ^ 2 + (y0 - ball(index).oy) ^ 2 < 400 then '計(jì)算被瞄準(zhǔn)的圓球

picture1.drawwidth = 1

picture1.fillcolor = vbred

picture1.circle (ball(index).ox, ball(index).oy), 3, vbwhite

picture1.fillstyle = 1 '透明填充

picture1.circle (ball(index).ox, ball(index).oy), 30, vbred

picture1.line (ball(index).ox - 30, ball(index).oy)-(ball(index).ox + 30, ball(index).oy), vbred

picture1.line (ball(index).ox, ball(index).oy - 30)-(ball(index).ox, ball(index).oy + 30), vbred

end if

if ball(index).oy - 25 > picture1.scaleheight then '判斷落地

initialball index

if split(label1.tag, *)(1) > 1 then '能量減1

label1.tag = split(label1.tag, *)(0) & * & split(label1.tag, *)(1) - 1

label1.caption = 分?jǐn)?shù): & split(label1.tag, *)(0) & vbcrlf & 能量: & split(label1.tag, *)(1)

else

label1.caption = 分?jǐn)?shù): & split(label1.tag, *)(0) & vbcrlf & 能量:0

msgbox 你失敗了,別灰心,降低難度,請重來!

initialgame iif(me.tag > 1, me.tag - 1, 1), 1

end if

end if

end sub

sub drawspark(byval index as integer) '畫火花

if sparks(index).ox <> 0 and sparks(index).oy <> 0 then

isout = 1

for i = 0 to 9

if abs(sparks(index).spark(i).posx - sparks(index).ox) < 100 and abs(sparks(index).spark(i).posy - sparks(index).oy) < 50 then

isout = 0

sparks(index).spark(i).posx = sparks(index).spark(i).posx + sparks(index).spark(i).speed * cos(sparks(index).spark(i).angle)

sparks(index).spark(i).posy = sparks(index).spark(i).posy - sparks(index).spark(i).speed * sin(sparks(index).spark(i).angle)

picture1.drawwidth = sparks(index).spark(i).size

picture1.pset (sparks(index).spark(i).posx, sparks(index).spark(i).posy), sparks(index).spark(i).sparkcolor

end if

next

if isout = 1 then sparks(index).ox = 0: sparks(index).oy = 0

end if

end sub

sub initialgame(byval level as integer, byval isclear as integer) '初始化游戲

option1(0).caption = 簡單

option1(1).caption = 中等

option1(2).caption = 較難

option1(3).caption = 高級(jí)

option1(level - 1).value = true '設(shè)置單選框選中當(dāng)前難度級(jí)別

timer1.interval = 20

me.scalemode = 3 '像素模式

picture1.scalemode = 3 '設(shè)置游戲窗口信息

picture1.autoredraw = true

picture1.width = 760

picture1.height = 500

if isclear = 1 then '清零積分和能量

label1.caption = 分?jǐn)?shù):0 & vbcrlf & 能量:5

label1.tag = 0*5

end if

me.tag = level '保存當(dāng)前等級(jí)

for i = 0 to 9 '初始化球圓球信息

initialball i

next

end sub

伊吾县| 都昌县| 柘荣县| 石嘴山市| 鹤壁市| 临清市| 根河市| 吴旗县| 双牌县| 保定市| 怀仁县| 尼玛县| 厦门市| 莎车县| 朝阳县| 巴中市| 疏附县| 南和县| 永胜县| 岗巴县| 石阡县| 绥江县| 广水市| 滕州市| 石狮市| 浪卡子县| 北碚区| 南昌县| 宝山区| 安国市| 靖宇县| 奎屯市| 马尔康县| 增城市| 皋兰县| 丰城市| 加查县| 廊坊市| 丹江口市| 威信县| 台东县|