Jul-31-2019, 02:56 AM
i am trying to make a pong game i have started from scratch twice now and i am noticing that the "ball" only bounces if i hover my mouse near the point where it should bounce.
import sys import pygame import os pygame.init() win = pygame.display.set_mode((600,500)) pygame.display.set_caption("pong?") win.fill((0, 0, 0)) pygame.display.flip() x1 = 305 y1 = 245 xvel = .05 yvel = .05 while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if y1 >= 490: yvel *= -1 pygame.draw.rect(win, (255, 255, 255), (x1, y1, 15, 15)) pygame.display.update() x1 += xvel y1 += yvel win.fill((0, 0, 0))