Hello I am quite new to pygame and I am trying to make an intro for a game where the user hovers over the computer screen and the screen then turns blue so indicate that when you press it the game will start. However, the blue rect simply isn't showing up? By the way, the introScreen is a like a gif but constructed from many different frames.
This is my code:
import pygame
import pygame.gfxdraw
import threading
pygame.init()
width = 800
height = 600
fps = 30
clock = pygame.time.Clock()
white = (255, 255, 255)
black = (0, 0, 0)
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
screen = pygame.display.set_mode((width, height))
def introLoop():
while intro:
for i in range(0, 26):
clock.tick(8)
i = str(i)
introScreen = pygame.image.load("introScreen/" + i + ".gif")
introScreen = pygame.transform.scale(introScreen, (width, height))
screen.blit(introScreen, (30, 30))
pygame.display.flip()
def gameLoop():
while intro:
mouseX, mouseY = pygame.mouse.get_pos()
startRectArea = pygame.Rect(279, 276, 220, 128)
if startRectArea.collidepoint(mouseX, mouseY):
StartRect = pygame.draw.rect(screen, blue, (279, 276, 220, 128), 0)
pygame.display.update()
for event in pygame.event.get():
holder = 0
introThread = threading.Thread(target = introLoop)
gameThread = threading.Thread(target = gameLoop)
intro = True
introThread.start()
gameThread.start()
There is no error message it just doesn't display the blue rect? Please help as I need this for a school project.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)