コード例 #1
0
def create_ufo(ai_settings, screen, ufo_imgs, points, ufo_group):
    ufo = Ufo(ai_settings, screen, ufo_imgs, points)
    ufo_width = ufo.rect.width
    ufo.x = 0 - ufo_width
    ufo.rect.x = ufo.x
    ufo.rect.y = 40
    ufo_group.add(ufo)
コード例 #2
0
def create_startrek(ai_settings, screen, startreks, startrek_number, row_number):
	"""creaye a startrek and place it in the row"""
	startrek = Ufo(ai_settings, screen)
	startrek_width = startrek.rect.width
	startrek.x = startrek_width + 2 * startrek_width * startrek_number
	startrek.rect.x = startrek.x
	startrek.rect.y = startrek.rect.height + 2 * startrek.rect.height * row_number
	startreks.add(startrek)
コード例 #3
0
ファイル: blue_sky.py プロジェクト: LukasKri/blue-sky-game
 def _create_ufo(self, ufo_number, row_number):
     """Create and UFO and place it in the row."""
     ufo = Ufo(self)
     ufo_width, ufo_height = ufo.rect.size
     ufo.x = 5 * ufo_width + 2 * ufo_width * ufo_number
     ufo.rect.x = ufo.x
     ufo.y = ufo_height + 2 * ufo_height * row_number
     ufo.rect.y = ufo.y
     self.ufos.add(ufo)
コード例 #4
0
def create_fleet(ai_settings, screen, ufoes):
    ufo = Ufo(ai_settings, screen)
    ufo_width = ufo.rect.width
    #available_space_x = ai_settings.screen_width - 2 * ufo_width
    #number_x = int(available_space_x / (2 * ufo_width))

    for row in range(3):
        for u in range(10):
            ufo = Ufo(ai_settings, screen)

            ufo.x = ufo_width + 2 * ufo_width * u

            ufo.rect.x = ufo.x
            ufo.rect.y = ufo.rect.height + 2 * ufo.rect.height * row

            ufoes.add(ufo)