From 7f9fa3ab53fa3014054f7b68aef658ae90c4c21b Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Mon, 7 May 2012 18:41:29 +0000 Subject: [PATCH] made the game a bit more interesting :) --- src/pong/Match.cpp | 22 ++++++++++++++-------- src/pong/Match.h | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/pong/Match.cpp b/src/pong/Match.cpp index 683defe..229a8fc 100644 --- a/src/pong/Match.cpp +++ b/src/pong/Match.cpp @@ -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); diff --git a/src/pong/Match.h b/src/pong/Match.h index ce7c0e1..8d36a08 100644 --- a/src/pong/Match.h +++ b/src/pong/Match.h @@ -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 entities; -- 2.39.2