code
unknown
plain_text
2 years ago
941 B
5
Indexable
import pygame # initializing pygame pygame.init() bg_color = (0, 200, 250) # screen stuff screen_height = 500 screen_width = 600 screen = pygame.display.set_mode((screen_width, screen_height)) # variables speed_x = 0 speed_y = 0 pos_x = 400 pos_y = 300 background_color = (0, 200, 250) radius = 15 color = (100, 100, 200) spot = [pos_x, pos_y] run = True mouse_down = False while run: for event in pygame.event.get(): if event.type == pygame.QUIT: run = False if event.type == pygame.MOUSEBUTTONDOWN: mouse_down = True if event.type == pygame.MOUSEBUTTONUP: mouse_down = False if mouse_down: speed_y = speed_y + 10 speed_y = speed_y - 0.1 screen.fill(background_color) pygame.draw.circle(screen, color, (spot[0],spot[1]), radius) spot[1] = spot[1] + speed_y pygame.display.update() pygame.quit()
Editor is loading...