Python Forum
how can i attach interact to a subject
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can i attach interact to a subject
#3
I'm sorry.So: -Yes,I'm using pygame.
-I'm making a number guessing game.

-What i want is when press the "start game now" button the screen will change to a different color and draw new shapes on the changed background, not on the first screen.

-And here is my code:

import pygame
pygame.init()

screen =pygame.display.set_mode((700,600))

font1=pygame.font.SysFont('t',45)
font2=pygame.font.SysFont('san',80)
mouse_x,mouse_y=pygame.mouse.get_pos()
print(mouse_x,mouse_y)

GREEN=(103, 181, 107)	
BLACK=(0, 0, 0)
BROWN=(219, 140, 37)
WHITE=(255, 250, 250)
text_1=font1.render('START GAME NOW',True,BLACK)
text_2=font2.render('NUMBER GUESSING',True,BLACK)

running= True
while running:
	
	screen.fill(BROWN)

	pygame.draw.rect(screen,WHITE,(170,300,350,180))
	screen.blit(text_1,(200,380))
	screen.blit(text_2,(85,50))

	for event in pygame.event.get():
		if event.type==pygame.QUIT:
			running=False
	
	pygame.display.flip()
 
I'm sorry because my terrible English and typing .But i hope you will help me.Thank you very much.
Reply


Messages In This Thread
RE: how can i attach interact to a subject - by Newbie1114 - May-28-2021, 03:04 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020