资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java打砖块代码 豪华打砖块java

跪求VB2010 编程的 打砖块 小游戏 要完整的文件夹 不用非常复杂的。

我在网上找到的实例,发到附件。

创新互联公司专注于义乌企业网站建设,响应式网站设计,商城网站开发。义乌网站建设公司,为义乌等地区提供建站服务。全流程按需网站制作,专业设计,全程项目跟踪,创新互联公司专业和态度为您提供的服务

主窗口代码:

Public Class Form1

Dim x As Integer = 1

Dim y As Integer = 1

Dim line As Integer = 12

Dim row As Integer = 12

Dim time_used As Integer = 0

Dim brick(line, row) As Button

Dim score As Integer = 0

Dim box_rectangle As Button = New Button

Dim box_ellipse As Button = New Button

Dim flage As Integer = 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Timer1.Enabled = True

score = 0

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

TextBox2.Text = Format(Now(), "yyyy/MM/dd HH:mm:ss")

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

time_used += 1

Label7.Text = time_used

End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick

box_ellipse.Location = New Point(box_ellipse.Location.X - x, box_ellipse.Location.Y - y)

If box_ellipse.Location.X 5 Or box_ellipse.Location.X 845 Then      '左右界

x = -x

End If

If box_ellipse.Location.Y 5 Then                                      '上界

y = -y

End If

If box_ellipse.Location.Y box_rectangle.Top - 10 Then                   '低于拍子

If box_ellipse.Location.X box_rectangle.Left And box_ellipse.Location.X box_rectangle.Right Then

y = -y

End If

End If

Dim i As Integer = 0

Dim j As Integer = 0

For i = 0 To line - 1

For j = 0 To row - 1

If box_ellipse.Left = brick(i, j).Left And box_ellipse.Left = brick(i, j).Left + brick(i, j).Width - box_ellipse.Width Then

If box_ellipse.Top = brick(i, j).Top + brick(i, j).Height And brick(i, j).Top + brick(i, j).Height = brick(i, j).Top And

brick(i, j).Visible Then

brick(i, j).Visible = False

GroupBox1.Controls.Remove(brick(i, j))

y = -y

score += 2

Label1.Text = score.ToString

End If

ElseIf brick(i, j).Text = "" And box_ellipse.Top = brick(i, j).Top + brick(i, j).Height - box_ellipse.Height And box_ellipse.Top = brick(i, j).Top Then

If box_ellipse.Left + box_ellipse.Width = brick(i, j).Left And box_ellipse.Left = brick(i, j).Left + brick(i, j).Width And

brick(i, j).Visible Then

brick(i, j).Visible = False

GroupBox1.Controls.Remove(brick(i, j))

x = -x

score += 2

Label1.Text = score.ToString

End If

End If

Next

Next

If box_ellipse.Top box_rectangle.Top - 2 Then                            '下界

Timer2.Enabled = False

Timer3.Enabled = False

MessageBox.Show("在练几年吧", "游戏结束")

End If

If score = 2 * line * row Then

Timer2.Enabled = False

Timer3.Enabled = False

MessageBox.Show("恭喜恭喜!!再来一局!!", "游戏结束")

End If

End Sub

Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If box_rectangle.Left = GroupBox1.Left And box_rectangle.Left = 785 Then

If e.KeyCode = Keys.Left Then

box_rectangle.Left -= 20

End If

If e.KeyCode = Keys.Right Then

box_rectangle.Left += 20

End If

ElseIf box_rectangle.Left GroupBox1.Left Then

If e.KeyCode = Keys.Left Then

box_rectangle.Left = 0

End If

If e.KeyCode = Keys.Right Then

box_rectangle.Left += 20

End If

ElseIf box_rectangle.Left 785 Then

If e.KeyCode = Keys.Left Then

box_rectangle.Left -= 20

End If

If e.KeyCode = Keys.Right Then

box_rectangle.Left = 805

End If

End If

End Sub

Private Sub BeginToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BeginToolStripMenuItem.Click

Timer2.Enabled = True

Timer2.Interval = 1000

Timer3.Enabled = True

Timer3.Interval = 1

Call Inite(line, row)

End Sub

Private Sub BridToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BridToolStripMenuItem.Click

Label6.Text = "Bird"

Call Inite(8, 8)

End Sub

Private Sub PlatinumToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlatinumToolStripMenuItem.Click

Label6.Text = "Platinum"

Call Inite(10, 10)

End Sub

Private Sub BoneToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BoneToolStripMenuItem.Click

Label6.Text = "Bone"

Call Inite(12, 12)

End Sub

Private Sub Inite(ByVal l As Integer, ByVal r As Integer)

Timer2.Enabled = True

Timer2.Interval = 1000

Timer3.Enabled = True

Timer3.Interval = 1

KeyPreview = True

line = l

row = r

If flage = 1 Then

GroupBox1.Controls.Clear()

End If

box_ellipse.Location = New Point(GroupBox1.Width / 2 - box_ellipse.Width / 2, GroupBox1.Height - 40)

box_ellipse.Size = New Size(10, 10)

box_ellipse.Name = ""

box_ellipse.BackColor = Color.Green

GroupBox1.Controls.Add(box_ellipse)

box_rectangle.Location = New Point(GroupBox1.Width / 2 - box_rectangle.Width / 2, GroupBox1.Height - 30)

box_rectangle.Size = New Size(60, 10)

box_rectangle.Name = ""

box_rectangle.BackColor = Color.Blue

GroupBox1.Controls.Add(box_rectangle)

Dim i As Integer

Dim j As Integer

For i = 0 To line - 1

For j = 0 To row - 1

brick(i, j) = New Button

brick(i, j).Location = New Point(15 + i * (GroupBox1.Width / line), 10 + j * 20)

brick(i, j).Size = New Size(60, 10)

brick(i, j).Name = i.ToString + j.ToString

brick(i, j).BackColor = Color.Red

GroupBox1.Controls.Add(brick(i, j))

Next

Next

flage = 1

End Sub

Private Sub ConcernToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConcernToolStripMenuItem.Click

MessageBox.Show("Made in China by liangzhijun4 !")

End Sub

Private Sub EndToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EndToolStripMenuItem.Click

Timer2.Enabled = False

Timer3.Enabled = False

MessageBox.Show("游戏结束", "常来玩哦~~")

End Sub

Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click

Timer2.Enabled = False

Timer3.Enabled = False

MessageBox.Show("游戏结束", "常来玩哦~~")

End

End Sub

Private Sub HelpToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem1.Click

MessageBox.Show("- 向右 ,-向左")

End Sub

End Class

C++打砖块游戏代码完整,有用。

#includestring.h

#includestdio.h

#include stdlib.h

#includeconio.h

int scr[22][50], q=14, w=30, ban=20, score=1, sx=-1 , zy=-1 ,speed=1, chang=30;

void moveqiu(void);

void penzhuangqiu(void);

void printf(void);

void menu(void);

main(void)

{

int i=0,j=0;

menu();

for(;j50;j++)

scr[i][j]=4;

j=0;i=1;

;for(;i3;i++)

for(j=2;j48;j++)

scr[i][j]=3;

//这里设置砖头位置

scr[q][w]=2;

while(1)

{

for(j=0;j20;j++)//将板位置归0

scr[21][ban+j]=0;

if(kbhit())//控制板的移动

switch(getch())

{

case'a':case'A':if(ban1ban=29) ban--;

break;

case'd':case'D':if(ban0ban=28) ban++;

break;

case'w':case'W':getch();break;//暂停键

}

for(j=0;j20;j++)//建立板位置为1

scr[21][ban+j]=1;

penzhuangqiu();

moveqiu();

printf();

}

}

void penzhuangqiu(void)

{

int b;

b=0;

if(zy==1)//以下四个if用来检测撞砖,并改变球的运动方向

if(scr[q][w+1]==3||w+1==49)

{

scr[q][w+1]=0;

zy=-zy;

b=1;

}

if(zy==-1)//判断运动又有方向

if(scr[q][w-1]==3||w-1==0)

{

scr[q][w-1]=0;

zy=-zy;

b=1;//用来确认是否敲打左右上下的方块

}

if(sx==1)

if(scr[q-1][w]==3||q-1==0)

{

scr[q-1][w]=0;

sx=-sx;

b=1;

}

if(sx==-1)

if(scr[q+1][w]==3||q+1==21)

{

if(scr[q+1][w]==3)

{scr[q+1][w]=0;

sx=-sx;

b=1;

}

if(q+1==21)

{if(scr[q+1][w]==1)

sx=-sx;

else

{

printf("lose!!!!!!退出游戏");

if(getch())

main();

}

}

}

if(b==0)//斜的砖块

{

if(zy==1sx==1)

if(scr[q-1][w+1]==3)

{

scr[q-1][w+1]=0;

zy=-zy;

sx=-sx;

}

if(zy==-1sx==1)

if(scr[q-1][w-1]==3)

{

scr[q-1][w-1]=0;

zy=-zy;

sx=-sx;

}

if(zy==1sx==-1)

if(scr[q+1][w+1]==3)

{

scr[q+1][w+1]=0;

zy=-zy;

sx=-sx;

}

if(zy==-1sx==-1)

if(scr[q+1][w-1]==3)

{

scr[q+1][w-1]=0;

zy=-zy;

sx=-sx;

}//斜砖完毕

}

}

void moveqiu(void)

{

scr[q][w]=0;//使原来的球位置为0,并建立新的球位置

if(sx==1zy==1)

{

q--;w++;

}

if(sx==1zy==-1)

{

q--;w--;

}

if(sx==-1zy==1)

{

q++;w++;

}

if(sx==-1zy==-1)

{

q++;w--;

}

scr[q][w]=2;

}

void printf(void)

{

int i, j;

system("cls");

for(i=0;i22;i++)

{

for(j=0;j50;j++)

{

if(scr[i][j]==0)printf(" ");

if(scr[i][j]==1)printf("\3");

if(scr[i][j]==2)printf("\4");

if(scr[i][j]==3)printf("\5");

if(scr[i][j]==4)printf("_");

if(j==49)

printf("|\n");

}

}

}

void menu(void)

{

q=14, w=30, ban=20, score=10, sx=-1 , zy=-1 ,speed=1, chang=30;memset(scr,0, sizeof(int)*1100);

system("cls");

printf("A向左,D向右,W暂停\n开始游戏:任意键\n ");

if(getch()) printf("aaaaaa");

}

一个简单的小游戏--打飞机。求一些方法。我会点C++,用Java也行。

这个貌似没什么难度。。。我自己写了一个

打砖块

的东西。。和这个差不多了。。

发你QQ

里边

,你看看。。呵呵。。。、期待交流!

QQ:279794658

请问怎么学好JAVA

要系统地掌握JAVA关联技术,不仅仅是JAVA基础,还有JDBC,JAVAScript,Servlet,JSP,JAVA框架等等,这些都要学习的。建议你在熟悉掌握JAVA基础知识的前提下,以这个顺利来学习吧:

JDBC--SERVLET--JSP--JAVA框架、、、、个人建议,仅供参考。

祝你成功~~

有一款小游戏,以前在手机里的JAVA里面玩的。一个长方框,里面会有一到十几不等的小球,颜色不一,在

幻想游戏合集。你搜打砖块,幻想游戏中的七宝弹球。

你下载一个应用宝,搜索名称就可以找到了,里面还有很多好玩的游戏,都是官网的。

幻想游戏是好玩的益智休闲游戏合集,在繁忙的工作、学习后,玩一会小游戏,既不会陷入其中,又能放松身心,一举两得。适合的人群也非常多,深得上班族、学生、及中老年朋友的喜爱。


网站名称:java打砖块代码 豪华打砖块java
路径分享:http://www.cdkjz.cn/article/dochcjh.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220