47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
from draw import *
|
|
from math import floor
|
|
|
|
def main():
|
|
C_BLACK = (0, 0, 0)
|
|
xspd = 1
|
|
yspd = 0
|
|
scrw = 0
|
|
scrh = 0
|
|
while get_pixel(scrw, 0):
|
|
scrw += 1
|
|
while get_pixel(0, scrh):
|
|
scrh += 1
|
|
x = floor(scrw / 2)
|
|
y = floor(scrh / 2)
|
|
|
|
clear_screen()
|
|
play = True
|
|
while play:
|
|
try:
|
|
while play:
|
|
x += xspd
|
|
y += yspd
|
|
if x == scrw:
|
|
x = 0
|
|
if y == scrh:
|
|
y = 0
|
|
if x == -1:
|
|
x = scrw - 1
|
|
if y == -1:
|
|
y = scrh - 1
|
|
if not get_pixel(x, y)[0]:
|
|
play = False
|
|
set_pixel(x, y, C_BLACK)
|
|
for i in range(100): show_screen()
|
|
except KeyboardInterrupt:
|
|
xspd, yspd = yspd, -xspd
|
|
|
|
loop = True
|
|
while loop:
|
|
try:
|
|
fancy_text(0, 0, "GAME OVER, press AC/ON to continue.")
|
|
while 1:
|
|
show_screen()
|
|
except:
|
|
loop = False
|