본문 바로가기

Not Using/game

11.18 beakout


 

#region Constants

/// Rectangles for our graphics, tested with the unit tests below.

static readonly Rectangle

            GamePaddleRect   = new Rectangle(39, 1, 93, 23),

            GameBallRect   = new Rectangle(1, 1, 36, 36),

            GameBlockRect   = new Rectangle(136, 1, 62, 27),

            GameYouWonRect   = new Rectangle(2, 39, 92, 21),

            GameYouLostRect   = new Rectangle(105, 39, 94, 21);

/// Ball speed multiplicator, this is how much screen space the ball will travel each sec.

const float BallSpeedMultiplicator = 0.85f;  //1;//0.75f;//0.5f;1  //공의 속도

/// How many block columns and rows are displayed?

const int NumOfColumns = 14,  NumOfRows = 12;

#endregion 


//변수초기화>

 

#region Variables

/// Texture

Texture2D backgroundTexture, gameTexture;  //2D texture로 배경텍스쳐와 게임텍스쳐(공과 패들, You won.. png를 가져오기 위해)를 선언

 /// Resolution of our game.

int width, height;  //윈도우의 가로세로크기

/// Current paddle positions, 0 means left, 1 means right.

float paddlePosition = 0.5f; //패들의 위치(y움직임이 없으므로 x위치만 선언)

/// Current ball position.

Vector2 ballPosition = new Vector2(0.5f, 0.95f - 0.035f);  //공의위치

/// Ball speed vector.

Vector2 ballSpeedVector = new Vector2(0, 0);  //공의속도,방향



/// Paddle, ball, block, etc. as sprite helpers.

SpriteHelper paddle, ball, block, youWon, youLost, background;  /*보조클래서 Spritehelper선언 (보조클래스를 사용한다는  using XnaBreakout.Helpers;  를 위에 선언해 주어야함 */

/// Level we are in and the current score.

/// Just updated in the windows title because we don't have font support yet.

int level = 0, score = -1; 

/// Wait until user presses space or A to start a level.

bool    pressSpaceToStart = true,   //SpacebarA 키를 누르면 게임 시작
            lostGame = false;   



/// All blocks of the current play field. If they are all cleared, we advance to the next /// level.

bool[,] blocks = new bool[NumOfColumns, NumOfRows];  /*블럭의 현재상태(있는지 없는지)   2차원array  (충돌해서 없거나 상태가 아예 없거나를 보여주기위해  1,아니면 0 이런식으로~ 하기위해 bool로 선언해주었다.*/

/// Block positions for each block we have, initialized in Initialize().

Vector2[,] blockPositions = new Vector2[NumOfColumns, NumOfRows];  //2차원array

/// Bounding boxes for each of the blocks, also precalculated and checked

/// each frame if the ball collides with one of the blocks.

BoundingBox[,] blockBoxes = new BoundingBox[NumOfColumns, NumOfRows]; /*블럭마다 바운딩박스이용(공이 모든 박스와 충돌을 해야되므로)        2차원array    */

#endregion







'Not Using > game' 카테고리의 다른 글

breakOut  (0) 2009.11.18
11.18 breakOut  (0) 2009.11.18
esc누르면 메뉴화면으로.. 애니메이션넣기는 미완성;  (0) 2009.11.10
애니메이션넣기  (1) 2009.11.04
게임제작  (0) 2009.10.14