Skip to content

Instantly share code, notes, and snippets.

@oschettler
Last active December 31, 2018 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oschettler/8421294424c03b57b57ca772e761d9e5 to your computer and use it in GitHub Desktop.
Save oschettler/8421294424c03b57b57ca772e761d9e5 to your computer and use it in GitHub Desktop.
Lines with PyGameZero
# Linien
# License: MIT
# Olav Schettler <olav@schettler.net>
WIDTH = 800
HEIGHT = 600
offset = 0
def incr_offset():
global offset
offset += 1
if offset > 39:
offset = 0
clock.schedule_interval(incr_offset, 0.1)
def draw():
screen.clear()
for x in range(0, WIDTH, 40):
screen.draw.line(
(0, HEIGHT - x - offset),
(x + offset, 0),
(255, 0, 0)
)
screen.draw.line(
(WIDTH, x + offset),
(WIDTH - x - offset, HEIGHT),
(255, 0, 0)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment