]> git.localhorst.tv Git - sdl-test7.git/commitdiff
made the game a bit more interesting :)
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 7 May 2012 18:41:29 +0000 (18:41 +0000)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 7 May 2012 18:41:29 +0000 (18:41 +0000)
src/pong/Match.cpp
src/pong/Match.h

index 683defe191eb9c154d564de9abf0922694d9563c..229a8fce034fd127c9303956e613d9b33099bb8c 100644 (file)
@@ -29,15 +29,16 @@ Match::Match(void)
 , scoreFont(TTF_OpenFont("data/font/Magra-Regular.ttf", 30))
 , leftScoreText(0)
 , rightScoreText(0)
-, paddleSpeed(150)
+, paddleSpeed(250)
 , worldWidth(800)
 , worldHeight(480)
 , ball(10)
 , secondBall(7)
+, thirdBall(7)
 , leftPaddle(Entity::Vector(10, 100))
 , rightPaddle(Entity::Vector(10, 100))
-, topWall(Entity::Vector(800, 10))
-, bottomWall(Entity::Vector(800, 10))
+, topWall(Entity::Vector(800, 20))
+, bottomWall(Entity::Vector(800, 20))
 , leftWall(Entity::Vector(10, 480))
 , rightWall(Entity::Vector(10, 480))
 , entities()
@@ -49,13 +50,17 @@ Match::Match(void)
        }
 
        ball.SetPosition(Entity::Vector(400, 240));
-       ball.SetVelocity(Entity::Vector(180, 180));
-       ball.SetMaxVelocity(500.0f);
+       ball.SetVelocity(Entity::Vector(190, 190));
+       ball.SetMaxVelocity(750.0f);
 
        secondBall.SetPosition(Entity::Vector(300, 240));
-       secondBall.SetVelocity(Entity::Vector(-20, -20));
+       secondBall.SetVelocity(Entity::Vector(-100, -100));
        secondBall.SetMaxVelocity(600.0f);
 
+       thirdBall.SetPosition(Entity::Vector(250, 440));
+       thirdBall.SetVelocity(Entity::Vector(100, 100));
+       thirdBall.SetMaxVelocity(600.0f);
+
        leftPaddle.SetPosition(Entity::Vector(0, 200));
        rightPaddle.SetPosition(Entity::Vector(790, 280));
 
@@ -65,7 +70,7 @@ Match::Match(void)
        leftPaddle.SetStatic();
        rightPaddle.SetStatic();
 
-       topWall.SetPosition(Entity::Vector(0, -10));
+       topWall.SetPosition(Entity::Vector(0, -20));
        rightWall.SetPosition(Entity::Vector(800, 0));
        bottomWall.SetPosition(Entity::Vector(0, 480));
        leftWall.SetPosition(Entity::Vector(-10, 0));
@@ -75,9 +80,10 @@ Match::Match(void)
        bottomWall.SetStatic();
        leftWall.SetStatic();
 
-       entities.reserve(8);
+       entities.reserve(9);
        entities.push_back(&ball);
        entities.push_back(&secondBall);
+       entities.push_back(&thirdBall);
        entities.push_back(&leftPaddle);
        entities.push_back(&rightPaddle);
        entities.push_back(&topWall);
index ce7c0e1a96f5250d42bed4fadd5b21472f0e1532..8d36a0854ada6811655eb2862d830fcce63a47da 100644 (file)
@@ -52,7 +52,7 @@ class Match
                SDL_Surface *leftScoreText, *rightScoreText;
                Sint32 paddleSpeed;
                Uint32 worldWidth, worldHeight;
-               Ball ball, secondBall;
+               Ball ball, secondBall, thirdBall;
                Paddle leftPaddle, rightPaddle;
                CountingWall topWall, bottomWall, leftWall, rightWall;
                std::vector<game::Entity *> entities;