Results 1 to 2 of 2
Thread: Word Guessing Game
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Sep 2012
Word Guessing Game
I added a .zip of the game with the menu images and everything, and I will include the code.
import sys, os, pygame pygame.init() screenSize = (500, 500) def Mouse(): mouseLoop = True cursorSize = (20, 20) while mouseLoop: screen = pygame.display.set_mode((screenSize), 0, 32) cursor = pygame.mouse.set_visible(False) cursor = pygame.image.load("cursor.png").convert_alpha() cursor = pygame.transform.scale(cursor, (30, 30))#Resize Image. cursor_x, cursor_y = pygame.mouse.get_pos() cursor_x -= cursor.get_width()/2 cursor_y -= cursor.get_height()/2 screen.blit(cursor, (cursor_x, cursor_y)) pygame.display.update() StartScreen() def startScreen(): s_color = (0, 0, 100) loop = True pygame.display.set_caption("Game Guess") #Set window Caption. screen = pygame.display.set_mode((screenSize)) screen.fill(s_color) s_text = pygame.font.Font(None, 100) text = s_text.render("Game Guess", True, (100,20, 50)) buttonStart = pygame.image.load("buttonStart.png") buttonExit = pygame.image.load("buttonExit.png") screen.blit(buttonStart, (100, 300)) screen.blit(buttonExit, (330, 300)) screen.blit(text, [40, 100]) Mouse() #while loop: # for event in pygame.event.get(): # if event.type == MOUSEBUTTONDOWN: # pygame.display.update() raw_input() Mouse() startScreen()
Last edited by awesomepilot; 03-25-2014 at 05:34 AM. Reason: mis type
I don't know anything about the pygame package and haven't even done anything with threading in python but what strikes me is that you have the loop in Mouse() with a control variable (mouseLoop) which is never changed. You'll never get to the call to startScreen() until the loop finishes and it never finishes the way you have it.
Also, what's StartScreen()? Is it a typo for startScreen()?? If so, why do you call that method twice?
I suspect you want one call to startScreen() and you need to run the Mouse method in some kind of thread. Infinite loops inside of a thread are not unusual at all. Although you might want to consider sleeping or yielding the CPU inside the loop to give your other thread(s) a fair chance to run. Just my opinion!!