public GameEngine() { DataLoader.LoadAllData(); coins = new Coins(); shop = new Shop(); paddleChooser = new PaddleChooser(); level = new LevelMenager(); expandBonus = new ExpandPaddle(); shortenBonus = new ShortenPaddle(); accelerateBonus = new AccelerateBall(); slowBonus = new SlowBall(); ball = new Ball(); window = new RenderWindow(new VideoMode((uint)Object.windowWidth, (uint)Object.windowHeigth), "Arkanoid", Styles.Default); window.SetFramerateLimit(60); state = GameState.MENU; window.Closed += (sender, arg) => Save(); window.MouseButtonReleased += MouseReleased; // ustawiamy obsługę zdarzeń window.KeyPressed += KeyPressed; GetCoins(); }
Bonus SpawnBonus(float pos_X, float pos_Y, int rand) { int pos_x = (int)pos_X; int pos_y = (int)pos_Y; Bonus bonus = new Bonus(pos_x, pos_y); if (rand == 1) { bonus = new ExpandPaddle(pos_x, pos_y); } else if (rand == 2) { bonus = new ShortenPaddle(pos_x, pos_y); } else if (rand == 3) { bonus = new AccelerateBall(pos_x, pos_y); } else if (rand == 4) { bonus = new SlowBall(pos_x, pos_y); } else if (rand == 5) { bonus = new SuperBall(pos_x, pos_y); } else if (rand == 6) { bonus = new ReverseControl(pos_x, pos_y); } else if (rand == 7) { bonus = new Coins(pos_x, pos_y); } return(bonus); }