Exemplo n.º 1
0
    def testAddObj(self):
        self.addThreeObjects()

        self.assertIn(self.o1, ObjectManager())
        self.assertIn(self.o2, ObjectManager())
        self.assertIn(self.o3, ObjectManager())
        self.assertEqual(3, ObjectManager().getNumObjects())
Exemplo n.º 2
0
    def testRemoveObj(self):
        self.addThreeObjects()
        ObjectManager().removeObj(self.o2)

        self.assertIn(self.o1, ObjectManager())
        self.assertNotIn(self.o2, ObjectManager())
        self.assertIn(self.o3, ObjectManager())
        self.assertEqual(2, ObjectManager().getNumObjects())
Exemplo n.º 3
0
    def testGetObjects(self):
        self.addThreeObjects()
        todos = ObjectManager().getObjects()

        self.assertIn(self.o1, todos)
        self.assertIn(self.o2, todos)
        self.assertIn(self.o3, todos)
        self.assertEqual(3, len(todos))
Exemplo n.º 4
0
from paddle import Paddle
from ball import Ball
from scoreboard import Scoreboard
from objectManager import ObjectManager
import time

screen = Screen()
screen.setup(width=800, height=850)
screen.bgcolor('black')
screen.title('Breakout Game')
screen.tracer(0)

paddle = Paddle(0, -250)
ball = Ball()
scoreboard = Scoreboard()
objects = ObjectManager()
objects_dict = objects.objects_generate()

screen.listen()
screen.onkey(paddle.move_left, 'a')
screen.onkey(paddle.move_right, 'd')

count = 0
speed = 0.05
game_is_on = True
checker_blue = 0
checker_orange = 0

while game_is_on:
    time.sleep(speed)
    screen.update()
Exemplo n.º 5
0
    def setUp(self):
        self.o1 = object()
        self.o2 = object()
        self.o3 = object()

        ObjectManager().clearObjects()
Exemplo n.º 6
0
 def addThreeObjects(self):
     ObjectManager().addObj(self.o1)
     ObjectManager().addObj(self.o2)
     ObjectManager().addObj(self.o3)
Exemplo n.º 7
0
    def testClearObjects(self):
        self.addThreeObjects()
        self.assertEqual(3, ObjectManager().getNumObjects())

        ObjectManager().clearObjects()
        self.assertEqual(0, ObjectManager().getNumObjects())
Exemplo n.º 8
0
 def testSingletonDesign(self):
     self.assertEqual(ObjectManager(), ObjectManager())