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
#1
I can't attach interact to a subject and i don"t know how to write it down.Help me please?
Reply
#2
Are you using pygame, or something else?
What's an interact? What's a subject? What do you expect to happen once they're attached?
Do you have any code we can look at?

In general, it's very hard to offer help if you don't let us know...
a) what's currently happening, and
b) what you expect to happen.
Gribouillis likes this post
Reply
#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
#4
(May-28-2021, 03:04 AM)Newbie1114 Wrote: I'm sorry.So: -Yes,I'm using pygame. shell shoclers
-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.

Thanks for your response. In the actual game I'm making I've got aabb collisions working, I understand that the code I posted is just drawing them and there's no collision detection in place yet.
Reply
#5
(May-28-2021, 03:04 AM)Newbie1114 Wrote: I'm sorry.So: -Yes,I'm using pygame. geometry dash unblocked

-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.
Because of the assistance that you provided, I was able to complete all of the schoolwork that was assigned to me. Please accept my sincere gratitude.
Reply


Forum Jump:

User Panel Messages

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