public int UpdateScene(int left, int top, int width, int height) { int goal = 0; Player1.Move(); Player2.Move(); Player1.DecreaseVelocity(); Player2.DecreaseVelocity(); Ball.EVodena = Ball.IsColiding(Player1); if (Ball.EVodena) { Ball.player = Player1; Player1.VodiTopka = true; Ball.Move(left, top, width, height); } else { Player1.VodiTopka = false; } Ball.EVodena = Ball.IsColiding(Player2); if (Ball.EVodena) { Ball.player = Player2; Player2.VodiTopka = true; } else { Player2.VodiTopka = false; } goal = Ball.Move(left, top, width, height); if (goal == 2) //Score za Desniot Player (Player 2) { ScorePlayer2++; GoalScored(); if (ScorePlayer2 == WinScore) { return(2); } } if (goal == 1) //Score za leviot player (Player 1) { ScorePlayer1++; GoalScored(); if (ScorePlayer1 == WinScore) { return(1); } } if (Ball.IsColiding(Player1)) { Ball.EVodena = true; //ako dojdat do topkata, pocnuvaat da ja vodat Ball.player = Player1; } if (Ball.IsColiding(Player2)) { Ball.EVodena = true; Ball.player = Player2; } return(0); }
internal void DecreaseVelocity() { Player1.DecreaseVelocity(); Player2.DecreaseVelocity(); }