程式码真的太长了不太可能全贴在这里= =
以下展示球的类别方法及其属性
游戏中有道具跟碰撞侦测而且是clr form的程式应该挺容易学的^^"
有兴趣的人看看吧
完整程式码下载
using namespace System::Drawing;
using namespace System::Media;
#pragma once
namespace Breakit{
static int CBallDiameter=20;
static int CheckPointsBrick=20;
static int HitScore;
static int GameBrickCount;
static int GameLife;
static int GameTime;
static int PropsBall=0;
public ref class ball
{
static SoundPlayer ^PongBallHit;
static bool PongBallHitOver;
public:
int WindowRight,WindowDown;
int x,y;
int previousUp,previousDown,previousLeft,previousRight;
int xspeed,yspeed;
System::Random^ rand;
ball()
{
xspeed=12,yspeed=-13;
rand=gcnew System::Random;
PongBallHit=gcnew SoundPlayer("sound\\PongBallHit.wav");
PongBallHitOver=false;
}
public:
void updatePoint()
{
previousUp=y,previousDown=y+CBallDiameter,previousLeft=x,previousRight=x+CBallDiameter;
}
void moving(System::Windows::Forms::PictureBox^ ball)
{
x+=xspeed;
y+=yspeed;
ball->Location = Point(x,y);
..
访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容