当前位置:首页 > 代码 > 正文

打飞机游戏源代码(java飞机游戏源代码)

admin 发布:2022-12-19 19:47 103


今天给各位分享打飞机游戏源代码的知识,其中也会对java飞机游戏源代码进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

我用delphi编了个打飞机的游戏,怎么让飞机爆炸时有相应爆炸声音?谢谢呀

百度、、、、下面是源代码:

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

MPlayer, StdCtrls;

type

TForm1 = class(TForm)

MediaPlayer1: TMediaPlayer;

Button1: TButton;

OpenDialog1: TOpenDialog;

procedure MediaPlayer1Notify(Sender: TObject);

procedure MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;

var DoDefault: Boolean);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.MediaPlayer1Notify(Sender: TObject);

begin

with MediaPlayer1 do

begin

if Notify and //接受信息

(mode=mpStopped) then//已经停止

begin

ReWind;

play;

end;

notify:=true;//开始接受信息

end;

end;

procedure TForm1.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;

var DoDefault: Boolean);

begin

if (Button=btStop) or (Button=btPause) then

MediaPlayer1.Notify:=false

else

MediaPlayer1.Notify:=true;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

if OpenDialog1.Execute then

with MediaPlayer1 do

begin

fileName:=OpenDialog1.FileName;

notify:=true;

try

open;

play;

except

raise exception.Create('打开文件时出错');

end;

caption:='循环播放演示--'+fileName;

end;

end;

end.

窗体As text代码

object Form1: TForm1

Left = 195

Top = 107

Width = 378

Height = 182

Caption = '循环播放演示'

Color = clBtnFace

Font.Charset = DEFAULT_CHARSET

Font.Color = clWindowText

Font.Height = -11

Font.Name = 'MS Sans Serif'

Font.Style = []

OldCreateOrder = False

PixelsPerInch = 96

TextHeight = 13

object MediaPlayer1: TMediaPlayer

Left = 24

Top = 16

Width = 298

Height = 33

TabOrder = 0

OnClick = MediaPlayer1Click

OnNotify = MediaPlayer1Notify

end

object Button1: TButton

Left = 193

Top = 104

Width = 129

Height = 33

Caption = '打开...'

Default = True

TabOrder = 1

OnClick = Button1Click

end

object OpenDialog1: TOpenDialog

Title = '打开音乐文件'

Left = 294

Top = 32

end

end

////////////////////////////////////////////////////

if FileExists(ExtractFilePath(Application.Exename)+'RunLib\T01.AVI') then

begin

MediaPlayer1.FileName:=(ExtractFilePath(Application.Exename)+'RunLib\T01.AVI');

MediaPlayer1.Open;

MediaPlayer1.Notify:=true;

MediaPlayer1.Display:=Form2;

MediaPlayer1.DisplayRect:=Form2.ClientRect;

MediaPlayer1.Play;

end;

然后如下让它循环

procedure TForm2.MediaPlayer1Notify(Sender: TObject);

begin

if MCIStop=1 then Exit;

if MediaPlayer1.Mode=mpStopped then

begin

MediaPlayer1.Rewind;

MediaPlayer1.Play;

end;

MediaPlayer1.Notify:=true;

end;

求一个C#打飞机的游戏,界面已经大概设计好了,求代码,大神的都来看看!指点下

我从来没做过这种,但是我觉得挺有趣的,我准备花2个小时来做~~~ 我一直做BS的~~~

我的思路是这样的

创建一个键值对,KEY是飞机对象,VALUE是飞机舞台位置

飞机超过边界就继续从对面边界开始,直到击毁

然后创建一个TIMER 每个1毫秒执行一次

武器:

每一次左键,发送一颗子弹 创建一个键值对 KEY 子弹对象,VALUE子弹位置,如果子弹超出边界,从子弹键值对中移出,如果子弹位置和飞机位置相等 触发击毁事件 飞机从飞机键值对中移除

用java编一个打飞机游戏的源程序

//将每一行按空格分割

string[] chars = line.Split(' ');

//根据第一个字符来判断数据的类型

switch(chars[0])

{

case "v":

//处理顶点

this.vertexArrayList.Add(new Vector3(

ConvertToFloat(chars[1]),

ConvertToFloat(chars[2]),

ConvertToFloat(chars[3]))

);

break;

case "vn":

//处理法线

this.normalArrayList.Add(new Vector3(

ConvertToFloat(chars[1]),

ConvertToFloat(chars[2]),

ConvertToFloat(chars[3]))

);

break;

case "vt":

//处理UV

this.uvArrayList.Add(new Vector3(

ConvertToFloat(chars[1]),

ConvertToFloat(chars[2]))

);

break;

case "f":

//处理面

GetTriangleList(chars);

break;

}

}

求WinForms字母游戏---类似金山打字通里的飞机游戏

这个和你所说的"打飞机"类似,但它不是打飞机,不知道你看怎么样!?

新建一个项目,在Form1上有两个控件:Timer,Ppanel.下来把事件加上就可以了!

注意是事件要注册,不能直接把代码复制进去产,一定要把事件双击出来,只复制下面给你事件的代码,不然就是徒劳!

//打字游戏

private void Form1_Load(object sender, EventArgs e)

{

this.timer1.Interval = 1000; //定时1秒

this.timer1.Start(); //定时启动

}

Random r = new Random();

private void timer1_Tick(object sender, EventArgs e)

{

Label l = new Label();

char cc = (char)((int)'A' + r.Next(26)); //随机产生26 个字母

l.Text = cc.ToString();

//l.BackColor = Color.Red;

l.ForeColor = Color.Red;

l.Left = r.Next(this.Width); //随机水平位置

foreach (Control c in this.panel1.Controls)

{

c.Top += 15; //向下移动

if (c.Top == this.Height) c.Dispose(); //到底消除

}

}

private void Form1_KeyDown(object sender, KeyEventArgs e)

foreach (Control c in this.panel1.Controls)

{

if (c.GetType() == typeof(Label))

{

Label t = (Label)c;

if (t.Text == e.KeyCode.ToString()) //按下的键有, 消除

this.panel1.Controls.Remove(c);

}

}

}

打飞机游戏源代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java飞机游戏源代码、打飞机游戏源代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/21356.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载