commit 0038062e27722f222d5b27d456a19f21af96d823 Author: rarmknecht Date: Sun Dec 21 08:27:20 2025 -0600 Migration from GitHub diff --git a/game.py b/game.py new file mode 100644 index 0000000..af8950e --- /dev/null +++ b/game.py @@ -0,0 +1,182 @@ +################################## +# +# Sight Words - For Kids by Kids +# +################################## +# TODO: +# - Add Scene to Pick Wordlists +# - Create CheckBox Object +# - Add Image to main screen +# - Add Image to Word Game +# - Make the Colors easier to change +# - Add Delay 'animation' to word changing +# - Add alphabet list + + +import random +import pygame +import pygame.freetype +import os + +FONT = "resources/fonts/iosevka-regular.ttf" +HEIGHT = 600 +WIDTH = 800 +DISPLAY = (WIDTH, HEIGHT) +DEPTH = 0 +FLAGS = 0 + +CORRECT = 0 +MISSED = 0 + +class Scene(object): + def __init__(self): + pass + + def render(self, screen): + raise NotImplementedError + + def update(self): + raise NotImplementedError + + def handle_events(self, events): + raise NotImplementedError + +class GameScene(object): + def next_word(self): + return self.words[random.randint(0,len(self.words)-1)] + + def write_word(self, screen, text): + # blank the word area + pygame.draw.rect(screen, + (20,20,20), + (0,0,WIDTH*0.75, HEIGHT), + 0 + ) + + # Write the current word + text_surface, _ = self.font.render(text, pygame.Color("DeepPink")) + text_rect = text_surface.get_rect(center=((WIDTH//8)*3, HEIGHT//2)) + screen.blit(text_surface, text_rect) + pygame.display.update() + + def __init__(self): + super(GameScene, self).__init__() + self.font = pygame.freetype.Font(FONT, 72) + self.sfont = pygame.freetype.Font(FONT, 24) + self.sound_correct = pygame.mixer.Sound('resources/sounds/MENU A_Select.wav') + self.sound_missed = pygame.mixer.Sound('resources/sounds/ALERT_Error.wav') + self.CORRECT = 0 + self.MISSED = 0 + self.updating = False + self.words = [] + + # Load all the words in the wordlists + path = "resources/wordlists/" + filelist = os.listdir(path) + for wordlistf in filelist: + with open(path+wordlistf) as f: + for line in f: + self.words.append(line.rstrip()) + print(self.words) + self.current_word = self.next_word() + pass + + def render(self, screen): + # Blank the Screen + screen.fill((20,20,20)) + + if self.updating: + self.write_word(screen, "...") + pygame.time.wait(200) + self.updating = False + + self.write_word(screen, self.current_word) + + # Write the Correct Score + yes_surface, _ = self.font.render(str(self.CORRECT), pygame.Color("Green")) + yes_rect = yes_surface.get_rect(center=((WIDTH//8)*7, (HEIGHT//3))) + screen.blit(yes_surface, yes_rect) + + # Write the Missed Score + no_surface, _ = self.font.render(str(self.MISSED), pygame.Color("Red")) + no_rect = no_surface.get_rect(center=((WIDTH//8)*7, (HEIGHT//3)*2)) + screen.blit(no_surface, no_rect) + + def update(self): + pass + + def handle_events(self, events): + for e in events: + if e.type == pygame.KEYDOWN: + if e.key == pygame.K_q: + pygame.quit() + elif e.key == pygame.K_m: + self.current_word = self.next_word() + pygame.mixer.Sound.play(self.sound_correct) + self.CORRECT += 1 + self.updating = True + elif e.key == pygame.K_z: + self.current_word = self.next_word() + pygame.mixer.Sound.play(self.sound_missed) + self.MISSED += 1 + self.updating = True + +class TitleScene(object): + + def __init__(self): + super(TitleScene, self).__init__() + self.font = pygame.freetype.Font(FONT, 72) + self.sfont = pygame.freetype.Font(FONT, 24) + + def render(self, screen): + # beware: ugly! + screen.fill((20, 20, 20)) + text1, _ = self.font.render('Sight Words', pygame.Color("DeepPink")) + text1_rect = text1.get_rect(center=(WIDTH//2,HEIGHT//2)) + screen.blit(text1, text1_rect) + + text2, _ = self.sfont.render('> press space to start <', pygame.Color("Purple")) + text2_rect = text2.get_rect(center=(WIDTH//2,(HEIGHT - 50))) + screen.blit(text2, text2_rect) + + def update(self): + pass + + def handle_events(self, events): + for e in events: + if e.type == pygame.KEYDOWN and e.key == pygame.K_SPACE: + self.manager.go_to(GameScene()) + #pygame.quit() + + +class SceneMananger(object): + def __init__(self): + self.go_to(TitleScene()) + + def go_to(self, scene): + self.scene = scene + self.scene.manager = self + +def main(): + pygame.init() + screen = pygame.display.set_mode(DISPLAY, FLAGS, DEPTH) + pygame.display.set_caption("Sight Words - For Kids By Kids") + clock = pygame.time.Clock() + running = True + + manager = SceneMananger() + + while running: + clock.tick(30) + + if pygame.event.get(pygame.QUIT): + running = False + return + manager.scene.handle_events(pygame.event.get()) + manager.scene.update() + manager.scene.render(screen) + pygame.display.flip() + + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..88d1df8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pygame==2.0.0 diff --git a/resources/fonts/iosevka-regular.ttf b/resources/fonts/iosevka-regular.ttf new file mode 100644 index 0000000..34e559d Binary files /dev/null and b/resources/fonts/iosevka-regular.ttf differ diff --git a/resources/inactivelists/firstgrade_q1 b/resources/inactivelists/firstgrade_q1 new file mode 100644 index 0000000..ae8d137 --- /dev/null +++ b/resources/inactivelists/firstgrade_q1 @@ -0,0 +1,39 @@ +then +big +my +me +as +then +some +the +two +and +of +a +I +you +your +his +her +hers +him +it +in +said +had +for +up +we +is +look +go +can +down +little +some +big +one +two +see +not +as diff --git a/resources/inactivelists/firstgrade_q2 b/resources/inactivelists/firstgrade_q2 new file mode 100644 index 0000000..9905547 --- /dev/null +++ b/resources/inactivelists/firstgrade_q2 @@ -0,0 +1,20 @@ +my +me +big +then +come +blue +red +could +where +jump +away +when +here +help +make +were +yellow +to +play +them diff --git a/resources/sounds/ALERT_Appear.wav b/resources/sounds/ALERT_Appear.wav new file mode 100644 index 0000000..29b1fd8 Binary files /dev/null and b/resources/sounds/ALERT_Appear.wav differ diff --git a/resources/sounds/ALERT_Dissappear.wav b/resources/sounds/ALERT_Dissappear.wav new file mode 100644 index 0000000..b915edc Binary files /dev/null and b/resources/sounds/ALERT_Dissappear.wav differ diff --git a/resources/sounds/ALERT_Error.wav b/resources/sounds/ALERT_Error.wav new file mode 100644 index 0000000..1bbd1c2 Binary files /dev/null and b/resources/sounds/ALERT_Error.wav differ diff --git a/resources/sounds/ETRA.wav b/resources/sounds/ETRA.wav new file mode 100644 index 0000000..9d67e1c Binary files /dev/null and b/resources/sounds/ETRA.wav differ diff --git a/resources/sounds/MENU A - Back.wav b/resources/sounds/MENU A - Back.wav new file mode 100644 index 0000000..a02f33a Binary files /dev/null and b/resources/sounds/MENU A - Back.wav differ diff --git a/resources/sounds/MENU A_Select.wav b/resources/sounds/MENU A_Select.wav new file mode 100644 index 0000000..af8f6c2 Binary files /dev/null and b/resources/sounds/MENU A_Select.wav differ diff --git a/resources/sounds/MENU B_Back.wav b/resources/sounds/MENU B_Back.wav new file mode 100644 index 0000000..090780f Binary files /dev/null and b/resources/sounds/MENU B_Back.wav differ diff --git a/resources/sounds/MENU B_Select.wav b/resources/sounds/MENU B_Select.wav new file mode 100644 index 0000000..eadba27 Binary files /dev/null and b/resources/sounds/MENU B_Select.wav differ diff --git a/resources/sounds/MENU_Pick.wav b/resources/sounds/MENU_Pick.wav new file mode 100644 index 0000000..09bb6ac Binary files /dev/null and b/resources/sounds/MENU_Pick.wav differ diff --git a/resources/sounds/MESSAGE-B_Accept.wav b/resources/sounds/MESSAGE-B_Accept.wav new file mode 100644 index 0000000..783ebfd Binary files /dev/null and b/resources/sounds/MESSAGE-B_Accept.wav differ diff --git a/resources/sounds/MESSAGE-B_Decline.wav b/resources/sounds/MESSAGE-B_Decline.wav new file mode 100644 index 0000000..da7ea2d Binary files /dev/null and b/resources/sounds/MESSAGE-B_Decline.wav differ diff --git a/resources/sounds/Notes.txt b/resources/sounds/Notes.txt new file mode 100644 index 0000000..da7e906 --- /dev/null +++ b/resources/sounds/Notes.txt @@ -0,0 +1,19 @@ +Title: UI Sound Pack 1 +Artist: ViRiX (David Mckee) +Creation: 2012 + +There are eleven user interface sounds in this pack at 44.1 KHZ in .wav format. Keep in mind though that just because it says UI doesn't mean you HAVE to use them for UI sounds. + +They can be used in any project, commercial or noncommercial. The only thing I ask is that you put the following in the credits. + +"Some of the sounds in this project were created by David McKee (ViRiX) +soundcloud.com/virix" + +If you'd like me to do some custom sounds or music for you, just contact me. + +email: dmckee1009@gmail.com +facebook: facebook.com/virixcore +Page: www.soundcloud.com/virix + +Thanks and enjoy. + diff --git a/resources/wordlists/alphabet b/resources/wordlists/alphabet new file mode 100644 index 0000000..49e807a --- /dev/null +++ b/resources/wordlists/alphabet @@ -0,0 +1,52 @@ +a +b +c +d +e +f +g +h +i +j +k +l +m +n +o +p +q +r +s +t +u +v +w +x +y +z +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z \ No newline at end of file diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..25b6906 Binary files /dev/null and b/test.txt differ