import pygame from pygame.locals import* import sys pygame.init() displaysurface = pygame.display.set_mode((300,300)) mySurface = pygame.Surface((50,50)) mySurface.fill((0,255,0)) mySurface2 = pygame.Surface((100,50)) mySurface2.fill((0,255,0)) while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() displaysurface.blit(mySurface, (50,50)) displaysurface.blit(mySurface2, (50,150)) pygame.display.update() object = pygame.Rect((20, 50), (50, 100)) class Player(pygame.sprite.Sprite): def _init_(self): super()._init_() self.image = pygame.image.load("Player_Sprite_R.png") self.rect = self.image.get_rect() pygame.draw.rect(surface, color, pygame.Rect(30, 30, 60, 60)) import pygame object1 = pygame.Rect((20, 50), (50, 100)) object2 = pygame.Rect((10, 10), (100, 100)) object3 = pygame.Rect((0, 0), (50, 50)) print(object1.colliderect(object2)) print(object1.colliderect(object3)) print(object2.colliderect(object3)) object1 = pygame.Rect((20, 50), (50, 100)) object1.move_ip(100, 100) print(object1.topleft) object2 = object1.move(100, 100) print(object2.topleft) while True: # Cycles through all the events currently occuring for event in pygame.event.get(): # Condition becomes true when keyboard is pressed if event.type == pygame.KEYDOWN: if event.key == pygame.K_m: fireball.fire() music_manager.playsound(fsound, 0.3) if event.key == pygame.K_n: handler.next_stage() if event.key == pygame.K_SPACE: player.jump() if event.key == pygame.K_RETURN: player.attack()