James Heavey
/
EL17JH
FINAL VERSION
Diff: Ball/Ball.cpp
- Revision:
- 70:812178dc3e32
- Parent:
- 40:ac53905346fb
- Child:
- 71:886cde5e2c63
--- a/Ball/Ball.cpp Sun May 05 16:28:29 2019 +0000 +++ b/Ball/Ball.cpp Sun May 05 16:45:25 2019 +0000 @@ -15,7 +15,7 @@ _size = size; _x = WIDTH/2 - _size/2; - _y = HEIGHT/2 - _size/2 + 10; + _y = HEIGHT - _size/2 - 5; srand(time(NULL)); int direction = rand() % 4; // randomise initial direction. @@ -23,16 +23,16 @@ // 4 possibilities. Get random modulo and set velocities accordingly if (direction == 0) { _velocity.x = speed; - _velocity.y = speed; + _velocity.y = -speed; } else if (direction == 1) { _velocity.x = -speed; - _velocity.y = speed; + _velocity.y = -speed; } else if (direction == 2) { _velocity.x = speed; - _velocity.y = speed; + _velocity.y = -speed; } else { _velocity.x = -speed; - _velocity.y = speed; + _velocity.y = -speed; } }