Last active
December 31, 2018 10:40
-
-
Save oschettler/8421294424c03b57b57ca772e761d9e5 to your computer and use it in GitHub Desktop.
Lines with PyGameZero
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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