コード例 #1
0
	def draw(self):

		if self.walk_count + 1 >= 27:
			self.walk_count = 0

		if not self.standing:

			if self.left:
				self.display.blit(images.walk_left[self.walk_count//3], (self.x,self.y) )
				self.walk_count += 1

			elif self.right:
				self.display.blit(images.walk_right[self.walk_count//3], (self.x,self.y) )
				self.walk_count += 1

		else: 

			if self.right:
				self.display.blit(images.walk_right[0], (self.x,self.y) )
			else:
				self.display.blit(images.walk_left[0], (self.x,self.y) )

		#Set the position as the character walks
		self.hitbox = pygame.Rect(self.x+18,self.y+12,28,50)

		functions.message_to_screen('Your life', self.display, colors.black, 80,30,14)

		#Draw lifebar
		pygame.draw.rect(self.display,colors.black, (28,48,104,24) )
		pygame.draw.rect(self.display,colors.red, (30,50,100,20) )
		pygame.draw.rect(self.display,colors.green, (30,50, self.health*10 ,20) )
コード例 #2
0
ファイル: Property.py プロジェクト: Anan7Codes/Monopoly-game
 def card(self):                                     #this sketches the card of the utility when called upon
     functions.gameDisplay.fill(white, rect = [170,400,200,250])
     lfont = pygame.font.Font('freesansbold.ttf',25)
     functions.text_in_box(self.name,lfont,black,170,410,200,30)
     functions.message_to_screen("Cost: $ %d"%self.cost,black,180,460,20)
     functions.message_to_screen("If one utility is owned",black,180,480,20)
     functions.message_to_screen("Rent = 1000*(sum on dice)",black,180,500,20)
     functions.message_to_screen("If both utilities are owned",black,180,520,20)
     functions.message_to_screen("Rent = 3000*(sum on dice)",black,180,540,20)
     
     
     pygame.display.update()
コード例 #3
0
def game_over():

	#Draw game over screen
	functions.message_to_screen("Game over",game_display,colors.red, display_width//2,display_height//2-50)
	functions.message_to_screen("Press C to play again or Q to quit",game_display,colors.black,
								display_width//2, display_height//2 + -10)
	pygame.display.update()

	while True:
		
		#Player choices
		for event in pygame.event.get():

			if event.type == pygame.QUIT:
				pygame.quit()
				quit()
			if event.type == pygame.KEYDOWN:
				
				if event.key == pygame.K_c:
				#Restart game

				elif event.key == pygame.K_q:
					pygame.quit()
コード例 #4
0
ファイル: Property.py プロジェクト: Anan7Codes/Monopoly-game
 def rcard(self):                            #this draws the card of the railway when called upon
     functions.gameDisplay.fill(white, rect = [170,400,200,250])
     lfont = pygame.font.Font('freesansbold.ttf',25)
     functions.text_in_box(self.name,lfont,black,170,410,200,30)
     functions.message_to_screen("Cost: $ %d"%self.cost,black,180,460,20)
     functions.message_to_screen("Owned          Rent",black,180,480,20)
     functions.message_to_screen("1 Railway      $2500",black,180,500,20)
     functions.message_to_screen("2 Railway      $5000",black,180,520,20)
     functions.message_to_screen("3 Railway      $10000",black,180,540,20)
     functions.message_to_screen("4 Railway      $20000",black,180,560,20)
     
     pygame.display.update()
コード例 #5
0
ファイル: Property.py プロジェクト: Anan7Codes/Monopoly-game
 def card(self):                     #this draws the card of the property with the respective details on it
     functions.gameDisplay.fill(white, rect = [170,400,200,250])
     lfont = pygame.font.Font('freesansbold.ttf',25)
     functions.text_in_box(self.name,lfont,self.color,170,410,200,30)
     functions.message_to_screen("Cost: $ %d"%self.cost,black,180,460,20)
     functions.message_to_screen("Rent: $ %d"%self.houses[0],black,180,480,20)
     functions.message_to_screen("1st floor: $ %d"%self.houses[1],black,180,500,20)
     functions.message_to_screen("2nd floor: $ %d"%self.houses[2],black,180,520,20)
     functions.message_to_screen("3rd floor: $ %d"%self.houses[3],black,180,540,20)
     functions.message_to_screen("Hotel: $ %d"%self.houses[4],black,180,560,20)
     functions.message_to_screen("Mortgage value: $ %d"%self.mortgage,black,190,600,20)
     pygame.display.update()