def test_midbottom( self ): """Changing the midbottom attribute moves the rect and does not change the rect's size """ r = Rect( 1, 2, 3, 4 ) new_midbottom = (r.centerx+20,r.bottom+30) expected_topleft = (r.left+20,r.top+30) old_size = r.size r.midbottom = new_midbottom self.assertEqual( new_midbottom, r.midbottom ) self.assertEqual( expected_topleft, r.topleft ) self.assertEqual( old_size, r.size )
def test_midbottom(self): """Changing the midbottom attribute moves the rect and does not change the rect's size """ r = Rect(1, 2, 3, 4) new_midbottom = (r.centerx + 20, r.bottom + 30) expected_topleft = (r.left + 20, r.top + 30) old_size = r.size r.midbottom = new_midbottom self.assertEqual(new_midbottom, r.midbottom) self.assertEqual(expected_topleft, r.topleft) self.assertEqual(old_size, r.size)
SHIPY = VIEWHEIGHT - SHIPSIZE VIEWBOUNDS = (SHIPSIZE // 2, VIEWWIDTH - SHIPSIZE // 2) # the bounds within which the ship can move SHIPSPEED = 200. # in pixels per second, how fast the backdrop moves MOVESPEED = 500. # for the ship moving sideways BOLTLENGTH = SHIPSIZE // 2 BOLTWIDTH = 3 BOLTSPEED = 500. # pixels per second ALIENBOLT = 1 SHIPBOLT = 2 SCOREBOARD = Rect(0, 0, VIEWWIDTH, SHIPSIZE) SCOREBOARD.midbottom = VIEWPORT.midtop STATUSBAR = Rect(0, 0, VIEWWIDTH, SHIPSIZE) STATUSBAR.midtop = VIEWPORT.midbottom DEBUGWINDOW = Rect(0, 0, (SCREENSIZE[0] - VIEWWIDTH) // 2, SCREENSIZE[1]) DEBUGWINDOW.bottomright = SCREENSIZE NR_OF_STARS = 50 # at what score, the player receives an extra life EXTRA_LIVES = [30000, 100000] # key mapping. # how to check whether keyboard is azerty or qwerty?