Toggle Navigation
TiDAL Hatchery
Eggs
Bad News Arcana
__init__.py
Users
Badges
Login
Register
__init__.py
raw
Content
from tidal import * from app import App, TextApp, ButtonOnlyWindow import vga2_8x8 as default_font import random import time display.fill(GREEN) class BadNews(TextApp): def on_start(self): super().on_start() self.cards = [] self.buttons.on_press(BUTTON_A,self.deal) def load_cards(self): display.text(default_font,'Bad News Arcana. v0.00000',0,0) display.text(default_font,'Loading card ',0,10) #13 chars for i in range(21): display.text(default_font,'{:02}'.format(i+1),13*8,10) self.cards.append(__import__('/apps/bad_news/card_{:02}'.format(i+1))) self.cards[-1].PALETTE=[0xffff,11363,49944,49944] display.text(default_font,'Loaded.',0,20) def show_card(self,which): display.fill(BLACK) display.bitmap(self.cards[which],0,0) text = '{}'.format(which+1) y = 0 for c in text: display.text(default_font,c,135-8,y) y = y + 10 def deal(self): which = random.randint(0,len(self.cards)-1) self.show_card(which) def update(self): self.show_card(1) def on_activate(self): super().on_activate() display.fill(BLACK) if len(self.cards) == 0: self.load_cards() display.text(default_font,'Press button A',0,30) display.text(default_font,'for a terrible',0,40) display.text(default_font,'foreshadowing.',0,50) main = BadNews