Browse Source

setup game

Daniel 5 years ago
parent
commit
d88d4f1ab9
2 changed files with 21 additions and 0 deletions
  1. 12
    0
      OOP_Pong/Game.h
  2. 9
    0
      OOP_Pong/functions.cpp

+ 12
- 0
OOP_Pong/Game.h View File

@@ -0,0 +1,12 @@
1
+#include <SFML/Graphics.hpp>
2
+#include <SFML/Audio.hpp>
3
+
4
+class Game {
5
+    private:
6
+        sf::Clock AITimer,
7
+                  Clock;
8
+        bool isPlaying;
9
+    public:
10
+        Game();
11
+
12
+};

+ 9
- 0
OOP_Pong/functions.cpp View File

@@ -1,5 +1,6 @@
1 1
 #include "Ball.h"
2 2
 #include "Paddle.h"
3
+#include "Game.h"
3 4
 
4 5
 
5 6
 Ball::Ball() {
@@ -68,4 +69,12 @@ sf::Vector2f Paddle::getSize() const {
68 69
 
69 70
 void Paddle::move(float x, float y) {
70 71
     sf::Transformable::move(x, y);
72
+}
73
+
74
+Ball::Ball() {
75
+    isPlaying = false;
76
+    const sf::Time AITime = sf::seconds(0.1f);
77
+    const float paddleSpeed = 400.f;
78
+    float rightPaddleSpeed = 0.f;
79
+    float ballAngle = 0.f;
71 80
 }