-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.py
More file actions
68 lines (57 loc) · 1.91 KB
/
Copy pathcalc.py
File metadata and controls
68 lines (57 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import pygame, sys, random
# Setup pygame/window ---------------------------------------- #
mainClock = pygame.time.Clock()
from pygame.locals import *
pygame.init()
pygame.display.set_caption('game base')
screen = pygame.display.set_mode((500, 500), 0, 32)
# a particle is...
# a thing that exists at a location
# typically moves around
# typically changes over time
# and typically disappears after a certain amount of time
# [loc, velocity, timer]
particles = []
# Loop ------------------------------------------------------- #
while True:
# Background --------------------------------------------- #
screen.fill((0, 0, 0))
mx, my = pygame.mouse.get_pos()
particles.append([[mx, my], [random.randint(0, 20) / 10 - 1, -2], random.randint(4, 6)])
for particle in particles:
particle[0][0] += particle[1][0]
particle[2] -= 0.1
particle[1][1] += 0.1
pygame.draw.circle(screen, (120, 120, 120), [int(particle[0][0]), int(particle[0][1])], int(particle[2]))
if particle[2] <= 0:
particles.remove(particle)
# Buttons ------------------------------------------------ #
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
pygame.quit()
sys.exit()
# Update ------------------------------------------------- #
pygame.display.update()
mainClock.tick(60)
#import pygame
#import sys
#
#pygame.font.init()
#
#sc = pygame.display.set_mode((300, 200))
#sc.fill((255, 255, 255))
#
#f1 = pygame.font.Font(None, 36)
#text1 = f1.render('5', True,
# (80, 80, 80))
#
#sc.blit(text1, (10, 50))
#pygame.display.update()
#while 1:
# for i in pygame.event.get():
# if i.type == pygame.QUIT:
# sys.exit()