Everything is in "main", gotta try on calc.

This commit is contained in:
KikooDX 2020-05-04 12:15:08 +02:00
parent dd382b394d
commit 26184e7f78
5 changed files with 95 additions and 91 deletions

View File

@ -18,10 +18,11 @@ pallet_last = 0
mem_pallet_last = 0
file:write([[from draw import *
black=(0,0,0)
for x in range(384):
for y in range(192):
set_pixel(x,y,black)
def main():
black=(0,0,0)
for x in range(384):
for y in range(192):
set_pixel(x,y,black)
]])
for i = 1, 12, 1 do
@ -36,7 +37,7 @@ for i = 1, 12, 1 do
end
local getpixel, setpixel = bitmap.pixel_interface(image_bitmap)
file:write("\n", [[data=b"]])
file:write("\n", [[ data=b"]])
--end
for j = 1, image_infos.height, 1 do
@ -54,19 +55,19 @@ for i = 1, 12, 1 do
--let's write the pallet
if pallet_last > mem_pallet_last then
mem_pallet_last = pallet_last
file:write("\npallet={")
file:write("\n pallet={")
for i, v in pairs(pallet) do
file:write(v, ":(", i, "),")
end
file:write("}")
end
file:write("\ndraw(", math.floor(192 - image_infos.width / 2), ",")
file:write("\n draw(", math.floor(192 - image_infos.width / 2), ",")
file:write(math.floor(96 - image_infos.height / 2), ",data,pallet,")
file:write(image_infos.width, ")")
first = false
end
file:write('\nwait_ac("Press AC/ON to continue...")')
file:write('\n wait_ac("Press AC/ON to continue...")')
file:close()

File diff suppressed because one or more lines are too long

View File

@ -7,9 +7,9 @@ cursor = 0
try:
while 1:
try:
clear_screen()
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
while 1:
clear_screen()
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
show_screen()
cursor += 1
if cursor == 64:
@ -23,9 +23,9 @@ try:
show_screen()
try:
play = __import__(choices[selection])
del play
play.main()
except KeyboardInterrupt:
pass
clear_screen()
except AssertionError:
pass
print("Thanks for 'playing'!")

81
tron.py
View File

@ -1,45 +1,46 @@
from draw import *
from math import floor
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)
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
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
loop = True
while loop:
try:
fancy_text(0, 0, "GAME OVER, press AC/ON to continue.")
while 1:
show_screen()
except:
loop = False

File diff suppressed because one or more lines are too long