public Collision(Ball ball, Block[,] blocks, Bar bar, BackgroundRect bg, int addScore) { this.ball = ball; this.blocks = blocks; this.bar = bar; this.bg = bg; this.addScore = addScore; this.player = new System.Media.SoundPlayer(Resources.sound); }
//背景からはみ出ているかチェックする public void overBackgroundCheck(BackgroundRect backgroundRect) { if (this.X + this.Width > backgroundRect.X + backgroundRect.Width) { this.X = backgroundRect.X + backgroundRect.Width - this.Width + 1; } if (this.X < backgroundRect.X) { this.X = backgroundRect.X + 1; } }
private void reset() { changeTitleFlag = false; totalScore = 0; plife = 2; LineUpBlocks(3, 11, 5, new Block(70, 60, 60, 30, 1)); bar = new Bar(400, 900, 200, 30, 10); ball = new Ball(600, 100, 20, 20, Ballspeed, Ballspeed, bar); bg = new BackgroundRect(10, 10, 800, 1000, Resources.Image1); collision = new Collision(ball, blocks, bar, bg, blockPerPoint); }