updated var names
This commit is contained in:
@@ -20,13 +20,13 @@ grey = (180, 180, 180)
|
|||||||
|
|
||||||
speed = 10
|
speed = 10
|
||||||
|
|
||||||
p_x = 100
|
p1_x = 100
|
||||||
p_y = 200
|
p1_y = 200
|
||||||
|
|
||||||
p_size = 100
|
p_size = 100
|
||||||
|
|
||||||
c_x = 600
|
p2_x = 600
|
||||||
c_y = 250
|
p2_y = 250
|
||||||
c_r = 100
|
|
||||||
|
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
@@ -36,36 +36,36 @@ while running:
|
|||||||
if e.type == QUIT:
|
if e.type == QUIT:
|
||||||
running = False
|
running = False
|
||||||
print("Programm closed by user input")
|
print("Programm closed by user input")
|
||||||
if e.type == MOUSEBUTTONDOWN:
|
# if e.type == MOUSEBUTTONDOWN:
|
||||||
m_x, m_y = mouse.get_pos()
|
# m_x, m_y = mouse.get_pos()
|
||||||
dx = m_x - c_x
|
# dx = m_x - c_x
|
||||||
dy = m_y - c_y
|
# dy = m_y - c_y
|
||||||
# if dx * dx + dy*dy <= c_r * c_r:
|
# if dx * dx + dy*dy <= c_r * c_r:
|
||||||
# c_color = green if c_color == red else red
|
# c_color = green if c_color == red else red
|
||||||
|
|
||||||
keys = key.get_pressed()
|
keys = key.get_pressed()
|
||||||
if keys[K_LEFT]:
|
if keys[K_LEFT]:
|
||||||
p_x -= speed
|
p1_x -= speed
|
||||||
if keys[K_RIGHT]:
|
if keys[K_RIGHT]:
|
||||||
p_x += speed
|
p1_x += speed
|
||||||
if keys[K_DOWN]:
|
if keys[K_DOWN]:
|
||||||
p_y += speed
|
p1_y += speed
|
||||||
if keys[K_UP]:
|
if keys[K_UP]:
|
||||||
p_y -= speed
|
p1_y -= speed
|
||||||
|
|
||||||
if keys[K_a]:
|
if keys[K_a]:
|
||||||
c_x -= speed
|
p2_x -= speed
|
||||||
if keys[K_d]:
|
if keys[K_d]:
|
||||||
c_x += speed
|
p2_x += speed
|
||||||
if keys[K_s]:
|
if keys[K_s]:
|
||||||
c_y += speed
|
p2_y += speed
|
||||||
if keys[K_w]:
|
if keys[K_w]:
|
||||||
c_y -= speed
|
p2_y -= speed
|
||||||
|
|
||||||
|
|
||||||
screen.fill(white)
|
screen.fill(white)
|
||||||
draw.rect(screen, blue, (p_x, p_y, p_size, p_size))
|
draw.rect(screen, blue, (p1_x, p1_y, p_size, p_size))
|
||||||
draw.rect(screen, green, (c_x, c_y, p_size, p_size))
|
draw.rect(screen, green, (p2_x, p2_y, p_size, p_size))
|
||||||
display.flip()
|
display.flip()
|
||||||
clock.tick(60)
|
clock.tick(60)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user