Exemplo n.º 1
0
        private void стартToolStripMenuItem_Click(object sender, EventArgs e)
        {
            timer1.Start();
            label2.Text = breek.ToString();

            label1.Text = ""; //Чтобы убрать надпись Game Over, когда начинаем игру не в первый раз
            for (int i = 0; i < ball_count; i++)
            {
                SuperBall ball;
                ball          = new SuperBall(matilda1, "3_метеорит2.png", ClientRectangle.Width / 2 - 25, ClientRectangle.Height / 2 - 25, 50, 50, "ball");
                ball.topstep  = matilda1.RandomInt(-30, 30);
                ball.leftstep = matilda1.RandomInt(-30, 30);
                balls.Add(ball);
            }

            desk          = matilda1.CreateSuperImage(null, ClientRectangle.Width / 2 - 50, ClientRectangle.Height - 30 - 30, 100, 30, "desk");
            desk.OnPaint += PaintDesk;

            int brick_top = 33;

            for (int i = 0; i < 3; i++)
            {
                int brick_left = 35;
                for (int j = 0; j < 16; /*именно столько помещается*/ j++)
                {
                    brick          = matilda1.CreateSuperImage(null, brick_left, brick_top, 100, 45, "rock");
                    brick.OnPaint += Brick_OnPaint;
                    brick_left    += 100 + 20;
                }
                brick_top += 45 + 33;
            }
        }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     if (tieSpeedToBall)
     {
         ball = GetComponentInChildren <SuperBall>();
         SyncSpeedToBall();
     }
     _startPos = transform.localPosition;
 }
Exemplo n.º 3
0
    public void SpawnBallOfType(SuperBall b)
    {
        var rnd = new System.Random();

        var playerPosX = GameManager.Instance.player.transform.position.x;
        var spawnPosX = (float)rnd.NextDouble() * (playerPosX + _maxDistance - playerPosX + _minDistance) + playerPosX + _minDistance;
        //var spawnPosY = (float)rnd.Next(-GameConfig.PHYSICS_GAME_HEIGHT, -GameConfig.PHYSICS_GAME_HEIGHT);

        GameObject.Instantiate(b, new Vector2(spawnPosX, 0), Quaternion.identity);
    }