public void Explode(Sprite brick) { score.IncreasePoints(); brick.Dispose(); renderer.Add(new FadeoutEffect(explosionImage, brick.DrawArea.Center, new Size(brickWidth))); explosionSound.Play(); }
private void HandleBrickCollision(Sprite brick, Direction collisionSide) { if (brick == null) return; Level.Explode(brick); ReflectVelocity(collisionSide); }
private void AddUIRight(Content content, Renderer renderer) { var rightImage = content.Load<Image>("UIRight"); rightWidth = rightImage.PixelSize.Width / Score.QuadraticFullscreenSize.Width; rightBorder = new Sprite(rightImage, new Rectangle(DrawArea.Right - rightWidth, DrawArea.Top + topHeight, rightWidth, DrawArea.Height - (bottomHeight + topHeight))) { RenderLayer = ForegroundLayer }; renderer.Add(rightBorder); }
private void AddUIBottom(Content content, Renderer renderer) { var bottomImage = content.Load<Image>("UIBottom"); bottomHeight = bottomImage.PixelSize.Height / Score.QuadraticFullscreenSize.Height; bottomBorder = new Sprite(bottomImage, new Rectangle(DrawArea.Left, DrawArea.Bottom - bottomHeight, DrawArea.Width, bottomHeight)) { RenderLayer = ForegroundLayer }; renderer.Add(bottomBorder); }
private void AddUITop(Content content, Renderer renderer) { var topImage = content.Load<Image>("UITop"); topHeight = topImage.PixelSize.Height / Score.QuadraticFullscreenSize.Height; topBorder = new Sprite(topImage, new Rectangle(DrawArea.Left, DrawArea.Top, DrawArea.Width, topHeight)) { RenderLayer = ForegroundLayer }; renderer.Add(topBorder); }
private Sprite CreateBrick(int x, int y) { var brick = new Sprite(brickImage, GetBounds(x, y), GetBrickColor(x, y)); renderer.Add(brick); return brick; }
private void AddBackground() { var image = content.Load<Image>("Background"); var background = new Sprite(image, renderer.Screen.Viewport) { RenderLayer = Background }; renderer.Add(background); renderer.Screen.ViewportSizeChanged += () => background.DrawArea = renderer.Screen.Viewport; }
private void AddTopFallingBrick(Sprite brick) { var filename = content.GetFilenameWithoutPrefix(brick.Image.Filename); var image = content.Load<Image>(filename + "_Top"); renderer.Add(new FallingEffect(image, brick.DrawArea, 5.0f) { Color = brick.Color, Velocity = new Point(Random.Get(-0.5f, 0.5f), Random.Get(-1.0f, 0.0f)), RotationSpeed = Random.Get(-360, 360), RenderLayer = (int)RenderLayer.FallingBrick }); }
private void AddFallingBrick(Sprite brick) { renderer.Add(new FallingEffect(brick.Image, brick.DrawArea, 5.0f) { Color = brick.Color, Velocity = new Point(Random.Get(-0.5f, 0.5f), Random.Get(-1.0f, 0.0f)), RotationSpeed = Random.Get(-360, 360), RenderLayer = (int)RenderLayer.FallingBrick }); }