Quentin Bock
unread,May 2, 2021, 3:23:50 PM5/2/21You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Code:
#imports and variables for game
import pygame
from pygame import mixer
running = True
#initializes pygame
pygame.init()
#creates the pygame window
screen = pygame.display.set_mode((1200, 800))
#Title and Icon of window
pygame.display.set_caption("3.02 Project")
icon = pygame.image.load('3.02 icon.png')
pygame.display.set_icon(icon)
#setting up font
pygame.font.init()
font = pygame.font.Font('C:\Windows\Fonts\OCRAEXT.ttf', 16)
font_x = 10
font_y = 40
items_picked_up = 0
items_left = 3
def main():
global running, event
#Game Loop
while running:
#sets screen color to black
screen.fill((0, 0, 0))
#checks if the user exits the window
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.quit()
def display_instruction(x, y):
instructions = font.render("Each level contains 3 items you
must pick up in each room.", True, (255, 255, 255))
instructions_2 = font.render("When you have picked up 3 items,
you will advance to the next room, there are 3.", True, (255, 255, 255))
instructions_3 = font.render("You will be able to change the
direction you are looking in the room, this allows you to find different
objects.", True, (255, 255, 255))
clear = font.render("Click to clear the text.", True, (255,
255, 255))
screen.blit(instructions, (10, 40))
screen.blit(instructions_2, (10, 60))
screen.blit(instructions_3, (10, 80))
screen.blit(clear, (10, 120))
if event.type == pygame.MOUSEBUTTONDOWN:
if event.type == pygame.MOUSEBUTTONUP:
screen.fill(pygame.Color('black')) # clears the screen text
display_instruction(font_x, font_y)
pygame.display.update()
main()
the error apparently comes from the first instructions variable saying
library not initialized not sure why, its worked before but not now :/