updated var names

This commit is contained in:
Finn-Luca Ortelbach
2026-03-12 14:29:59 +01:00
parent c44e2f433c
commit 46ae5f0da4
+19 -19
View File
@@ -20,13 +20,13 @@ grey = (180, 180, 180)
speed = 10
p_x = 100
p_y = 200
p1_x = 100
p1_y = 200
p_size = 100
c_x = 600
c_y = 250
c_r = 100
p2_x = 600
p2_y = 250
running = True
@@ -36,36 +36,36 @@ while running:
if e.type == QUIT:
running = False
print("Programm closed by user input")
if e.type == MOUSEBUTTONDOWN:
m_x, m_y = mouse.get_pos()
dx = m_x - c_x
dy = m_y - c_y
# if e.type == MOUSEBUTTONDOWN:
# m_x, m_y = mouse.get_pos()
# dx = m_x - c_x
# dy = m_y - c_y
# if dx * dx + dy*dy <= c_r * c_r:
# c_color = green if c_color == red else red
keys = key.get_pressed()
if keys[K_LEFT]:
p_x -= speed
p1_x -= speed
if keys[K_RIGHT]:
p_x += speed
p1_x += speed
if keys[K_DOWN]:
p_y += speed
p1_y += speed
if keys[K_UP]:
p_y -= speed
p1_y -= speed
if keys[K_a]:
c_x -= speed
p2_x -= speed
if keys[K_d]:
c_x += speed
p2_x += speed
if keys[K_s]:
c_y += speed
p2_y += speed
if keys[K_w]:
c_y -= speed
p2_y -= speed
screen.fill(white)
draw.rect(screen, blue, (p_x, p_y, p_size, p_size))
draw.rect(screen, green, (c_x, c_y, p_size, p_size))
draw.rect(screen, blue, (p1_x, p1_y, p_size, p_size))
draw.rect(screen, green, (p2_x, p2_y, p_size, p_size))
display.flip()
clock.tick(60)