replaced function with more effiecent code

This commit is contained in:
superdimensional 2021-05-02 00:15:35 -04:00
parent 1c1f2195f2
commit df5f5d4263
2 changed files with 15 additions and 37 deletions

View file

@ -2,7 +2,7 @@
def alien_table(index):
return {
0: "OFF",
0: "Omnitrix",
1: "Heatblast",
2: "Ripjaws",
3: "Diamondhead",
@ -23,31 +23,4 @@ def alien_table(index):
18: "Frankenstrike",
19: "Blitzwolfer",
# TODO: Add more aliens
}.get(index, "ERROR")
def image_display(index):
return {
0: "res/Omnitrix.png",
1: "res/Heatblast.png",
2: "res/ripJaws.png",
3: "res/Diamondhead.png",
4: "res/Stinkfly.png",
5: "res/Four Arms.png",
6: "res/Upgrade.png",
7: "res/XLR8.png",
8: "res/Grey Matter.png",
9: "res/Wildmutt.png",
10: "res/Ghostfreak.png",
11: "res/Wildvine.png",
12: "res/Cannonbolt.png",
13: "res/Upchuck.png",
14: "res/Way Big.png",
15: "res/Eye Guy.png",
16: "res/Snare-oh.png",
17: "res/Ditto.png",
18: "res/Frankenstrike.png",
19: "res/Blitzwolfer.png",
# ! write function to take name from alien_table and get locationto
}.get(index, "res/omnitrix.png")
}.get(index, 0)

View file

@ -34,13 +34,7 @@ def count_down(omnitrix_button):
def button_press():
sound("res/sound_transformation.mp3")
if counter < 0:
print(alien_table(counter * -1))
elif counter == 0:
print(alien_table(counter))
elif counter > 0:
print(alien_table(counter))
# ! replace with sound playing function
def skip_up(omnitrix_button):
@ -72,4 +66,15 @@ def skip_down(omnitrix_button):
def start():
sound("res/sound_startup.mp3")
sound("res/sound_startup.mp3")
def image_display(index):
alien = alien_table(index)
if(alien == 0):
global counter
counter = 0
return "res/Omnitrix.png"
else:
image_location = "res/" + alien + ".png"
return image_location