예제 #1
0
	def __get_screen_data(self):
		
		if self.__is_first_level():
			img = mygame.load_image(get_image_pathname('deckstart.bmp'))
			if RESIZE:
				img = img.scale((int(img.get_width()*HUD_RESIZE_FACTOR),int(img.get_height() *HUD_RESIZE_FACTOR)))
			x=0
			y=(SCREEN_Y - img.get_height()) /2
			
			TEXT_Y = SCREEN_Y * 0.2
			TEXT_X = SCREEN_X * 0.1 
			TEXT_W = SCREEN_X * 0.85
			TEXT_H = SCREEN_Y * 0.8
			
			
			return img,x,y,TEXT_X,TEXT_Y,TEXT_W,TEXT_H,0

		else:
			
			img = mygame.load_image(get_image_pathname('decklift.bmp'))
			if RESIZE:
				img = img.scale((int(img.get_width()*HUD_RESIZE_FACTOR),int(img.get_height() *HUD_RESIZE_FACTOR)))
			x=0
			y=(SCREEN_Y - img.get_height()) /2
			
			TEXT_Y = SCREEN_Y * 0.1
			TEXT_X = SCREEN_X * 0.3 
			TEXT_W = SCREEN_X * 0.6
			TEXT_H = SCREEN_Y * 0.8
			
			LIFT_X = 30
			if RESIZE:
				LIFT_X = int(LIFT_X * RESIZE_FACTOR)
			
			return img,x,y,TEXT_X,TEXT_Y,TEXT_W,TEXT_H,LIFT_X
	def __init__(self, player_stats, my_game):
		self.player_stats = player_stats
		self.my_game = my_game
		self.hud_img = mygame.load_image(get_image_pathname(HUD_IMAGE))
		
		self.hud_gold = mygame.load_image(get_image_pathname(HUD_GOLD_IMAGE))
		
		self.hud_gold_big_blip = my_game.create_blank((2, self.hud_gold.get_height()))
		self.hud_gold_big_blip.blit(self.hud_gold, self.hud_gold_big_blip.get_rect(), self.hud_gold_big_blip.get_rect())
		
		self.hud_gold_plus = mygame.load_image(get_image_pathname(HUD_GOLD_PLUS))
		self.hud_gold_plus.set_colorkey(mygame.Colour(0xff,0,0xff))
		
		self.hud_gold_small_blip = my_game.create_blank((1, self.hud_gold.get_height()))
		self.hud_gold_small_blip.blit(self.hud_gold, self.hud_gold_small_blip.get_rect(), self.hud_gold_small_blip.get_rect())

		self.health_bar_x = 32
		self.lives_x = 134
		self.big_tick_x_increment = 4
		self.small_tick_x_increment = 2
		self.ammo_x = 206
		self.small_ammo_x = 250
		self.keys_x = 337
		
		self.health_bars = dict()
		
		if RESIZE:
			self.hud_img = self.hud_img.scale((int(self.hud_img.get_width() *HUD_RESIZE_FACTOR),int(self.hud_img.get_height() *HUD_RESIZE_FACTOR)))
			
			self.hud_gold = self.hud_gold.scale((int(self.hud_gold.get_width() *HUD_RESIZE_FACTOR),int(self.hud_gold.get_height() *HUD_RESIZE_FACTOR)))
			
			
			self.hud_gold_big_blip = self.hud_gold_big_blip.scale((int(self.hud_gold_big_blip.get_width() *HUD_RESIZE_FACTOR),int(self.hud_gold_big_blip.get_height() *HUD_RESIZE_FACTOR)))
			
			self.hud_gold_small_blip = self.hud_gold_small_blip.scale((int(self.hud_gold_small_blip.get_width() *HUD_RESIZE_FACTOR),int(self.hud_gold_small_blip.get_height() *HUD_RESIZE_FACTOR)))
			
			self.hud_gold_plus = self.hud_gold_plus.scale((int(self.hud_gold_plus.get_width() *HUD_RESIZE_FACTOR),int(self.hud_gold_plus.get_height() *HUD_RESIZE_FACTOR)))
			
			self.health_bar_x = int(self.health_bar_x * HUD_RESIZE_FACTOR)
			self.lives_x = int(self.lives_x * HUD_RESIZE_FACTOR)
			self.big_tick_x_increment = int(self.big_tick_x_increment * HUD_RESIZE_FACTOR)
			self.ammo_x = int(self.ammo_x * HUD_RESIZE_FACTOR)
			self.keys_x = int(self.keys_x * HUD_RESIZE_FACTOR)
			self.small_tick_x_increment = int(self.small_tick_x_increment * HUD_RESIZE_FACTOR)
			self.small_ammo_x = int(self.small_ammo_x * HUD_RESIZE_FACTOR)
예제 #3
0
	def load_images(self):
		for i in range(1,10):
			img_name = 'gameover%d.bmp' % i
			img = mygame.load_image(get_image_pathname(img_name))
			if RESIZE:
				img = img.scale((int(img.get_width()*RESIZE_FACTOR),int(img.get_height() *RESIZE_FACTOR)))
			self.frames.append(img)
			
		w = self.frames[8].get_width()
		h = self.frames[8].get_height()
		
		self.x = (SCREEN_X - w) / 2
		self.y = (SCREEN_Y - h) / 2
예제 #4
0
	def __get_screen_data(self):
		
		img = mygame.load_image(get_image_pathname('ending.bmp'))
		if RESIZE:
			img = img.scale((SCREEN_X, SCREEN_Y))
		x=0
		y=(SCREEN_Y - img.get_height()) /2
		
		TEXT_Y = SCREEN_Y * 0.1
		TEXT_X = SCREEN_X * 0.1 
		TEXT_W = SCREEN_X * 0.8
		TEXT_H = SCREEN_Y * 0.8
		
		return img,x,y,TEXT_X,TEXT_Y,TEXT_W,TEXT_H
예제 #5
0
	def __init__(self, my_game, menu_background):
		Scene.__init__(self, 'menu')
		self.my_game = my_game
		self.menu_background = menu_background
		self.img = mygame.load_image(get_image_pathname('alienhead.bmp'))
		
		if RESIZE:
			self.img = self.img.scale((int(self.img.get_width()*RESIZE_FACTOR),int(self.img.get_height() *RESIZE_FACTOR)))
		trans = mygame.Colour(255, 0, 255)
		self.img.set_colorkey(trans)
				
		self.x=(SCREEN_X - self.img.get_height()) /2
		self.y= SCREEN_Y +100
		
		key_set = KeySet.load_key_set()
		self.proceed_button = key_set.fire
		self.df = DebugFont()
		self.menu = GameMenu(my_game)
예제 #6
0
	def start(self):
		self.img = mygame.load_image(get_image_pathname('IntexBG.bmp'))
		self.img.set_colorkey(mygame.Colour(0xff, 0, 0xff))
		if RESIZE:
			self.img = self.img.scale((int(self.img.get_width()*HUD_RESIZE_FACTOR),int(self.img.get_height() *HUD_RESIZE_FACTOR)))
예제 #7
0
    def __init__(self, player_stats, my_game):
        self.player_stats = player_stats
        self.my_game = my_game
        self.hud_img = mygame.load_image(get_image_pathname(HUD_IMAGE))

        self.hud_gold = mygame.load_image(get_image_pathname(HUD_GOLD_IMAGE))

        self.hud_gold_big_blip = my_game.create_blank(
            (2, self.hud_gold.get_height()))
        self.hud_gold_big_blip.blit(self.hud_gold,
                                    self.hud_gold_big_blip.get_rect(),
                                    self.hud_gold_big_blip.get_rect())

        self.hud_gold_plus = mygame.load_image(
            get_image_pathname(HUD_GOLD_PLUS))
        self.hud_gold_plus.set_colorkey(mygame.Colour(0xff, 0, 0xff))

        self.hud_gold_small_blip = my_game.create_blank(
            (1, self.hud_gold.get_height()))
        self.hud_gold_small_blip.blit(self.hud_gold,
                                      self.hud_gold_small_blip.get_rect(),
                                      self.hud_gold_small_blip.get_rect())

        self.health_bar_x = 32
        self.lives_x = 134
        self.big_tick_x_increment = 4
        self.small_tick_x_increment = 2
        self.ammo_x = 206
        self.small_ammo_x = 250
        self.keys_x = 337

        self.health_bars = dict()

        if RESIZE:
            self.hud_img = self.hud_img.scale(
                (int(self.hud_img.get_width() * HUD_RESIZE_FACTOR),
                 int(self.hud_img.get_height() * HUD_RESIZE_FACTOR)))

            self.hud_gold = self.hud_gold.scale(
                (int(self.hud_gold.get_width() * HUD_RESIZE_FACTOR),
                 int(self.hud_gold.get_height() * HUD_RESIZE_FACTOR)))

            self.hud_gold_big_blip = self.hud_gold_big_blip.scale(
                (int(self.hud_gold_big_blip.get_width() * HUD_RESIZE_FACTOR),
                 int(self.hud_gold_big_blip.get_height() * HUD_RESIZE_FACTOR)))

            self.hud_gold_small_blip = self.hud_gold_small_blip.scale(
                (int(self.hud_gold_small_blip.get_width() * HUD_RESIZE_FACTOR),
                 int(self.hud_gold_small_blip.get_height() *
                     HUD_RESIZE_FACTOR)))

            self.hud_gold_plus = self.hud_gold_plus.scale(
                (int(self.hud_gold_plus.get_width() * HUD_RESIZE_FACTOR),
                 int(self.hud_gold_plus.get_height() * HUD_RESIZE_FACTOR)))

            self.health_bar_x = int(self.health_bar_x * HUD_RESIZE_FACTOR)
            self.lives_x = int(self.lives_x * HUD_RESIZE_FACTOR)
            self.big_tick_x_increment = int(self.big_tick_x_increment *
                                            HUD_RESIZE_FACTOR)
            self.ammo_x = int(self.ammo_x * HUD_RESIZE_FACTOR)
            self.keys_x = int(self.keys_x * HUD_RESIZE_FACTOR)
            self.small_tick_x_increment = int(self.small_tick_x_increment *
                                              HUD_RESIZE_FACTOR)
            self.small_ammo_x = int(self.small_ammo_x * HUD_RESIZE_FACTOR)