def test_midright( self ): """Changing the midright attribute moves the rect and does not change the rect's size """ r = Rect( 1, 2, 3, 4 ) new_midright= (r.right+20,r.centery+30) expected_topleft = (r.left+20,r.top+30) old_size = r.size r.midright = new_midright self.assertEqual( new_midright, r.midright ) self.assertEqual( expected_topleft, r.topleft ) self.assertEqual( old_size, r.size )
def test_midright(self): """Changing the midright attribute moves the rect and does not change the rect's size """ r = Rect(1, 2, 3, 4) new_midright = (r.right + 20, r.centery + 30) expected_topleft = (r.left + 20, r.top + 30) old_size = r.size r.midright = new_midright self.assertEqual(new_midright, r.midright) self.assertEqual(expected_topleft, r.topleft) self.assertEqual(old_size, r.size)
def game_init(state): state["inmenu"] = False state["gameover"] = False state["score"] = [0,0] state["p1"] = Rect((0,0), PADDLE_SIZE) state["p2"] = Rect((0,0), PADDLE_SIZE) state["p1"].midleft = DIST_FROM_EDGE, state["bounds"].centery state["p2"].midright = state["bounds"].width - DIST_FROM_EDGE, state["bounds"].centery if not state["paused"]: state["toserve"] = 0 pass
def game_init(state): state["inmenu"] = False state["gameover"] = False state["score"] = [0, 0] state["p1"] = Rect((0, 0), PADDLE_SIZE) state["p2"] = Rect((0, 0), PADDLE_SIZE) state["p1"].midleft = DIST_FROM_EDGE, state["bounds"].centery state["p2"].midright = state["bounds"].width - DIST_FROM_EDGE, state[ "bounds"].centery if not state["paused"]: state["toserve"] = 0 pass