This is my error:
However there is a file at 'C:/Python34/Python34/build/exe.win32-3.4/library.zip/pygame/freesansbold.ttf' Look:
When I check for the file by swiping in from right on my computer and typing address it also says it doesn't exist. Why is this as it clearly does!?!?!?
I know other people have asked SIMILAR questions but none of them answer my question. EXTRA INFORMATION: The program works in IDLE fine, but not when compiled I'm using Python 3.4 32-Bit and Pygame 32-Bit I'm on Windows 8.1 64-Bit I'm trying to make flappy cube :P
If you need any extra info, just ask! `
import pygame
import random
import time
pygame.init()
display_width = 1450
display_height = 720
cube_width = 5
white = (255,255,255)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
black = (0,0,0)
lel = (205,205,255)
cube_colour = white
gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('Flappy Cube')
clock = pygame.time.Clock()
dodged = 0
################################################################################
def things_dodged(count):
font = pygame.font.Font('freesansbold.ttf',50)
text = font.render("Dodged: "+str(count),True,blue)
gameDisplay.blit(text,(0,0))
pygame.display.update()
def cube_draw(cubex, cubey, cube_width, cube_height, colour):
pygame.draw.rect(gameDisplay, colour, [cubex, cubey, cube_width, cube_height])
pygame.display.update()
def pipe_draw(pipex,pipey,pipe_width,pipe_height,colour):
pygame.draw.rect(gameDisplay, colour,[pipex, pipey, pipe_width, pipe_height])
def msg_objects(msg, font):
msgSurf = font.render(msg, True, blue)
return msgSurf, msgSurf.get_rect()
def message_display(msg):
font_size = pygame.font.Font('freesansbold.ttf',72)
msgSurf, msgRect = msg_objects(msg, font_size)
msgRect.center = ((display_width /2), (display_height / 2))
gameDisplay.blit(msgSurf, msgRect)
pygame.display.update()
time.sleep(1)
game_loop()
def crash(msg):
message_display(msg)
################################################################################
def game_loop():
pipex = 500
pipey = display_height
pipe_width = 10
pipe_height10 = random.randint(30,500)
while pipe_height10 % 30 != 0:
pipe_height10 = random.randint(30,500)
pipe_height = pipe_height10 * -1
#
up_pipex = 500
up_pipey = 0
up_pipe_width = 10
up_pipe_height = display_height - (pipe_height * -1) - 80
###
pipex1 = 1000
pipey1 = display_height
pipe_width1 = 10
pipe_height11 = random.randint(30,500)
while pipe_height11 % 30 != 0:
pipe_height11 = random.randint(30,500)
pipe_height1 = pipe_height11 * -1
#
up_pipex1 = 1000
up_pipey1 = 0
up_pipe_width1 = 10
up_pipe_height1 = display_height - (pipe_height1 * -1) - 90
###
cubex = 20
cubey = (display_height / 2)
cube_width = 40
cube_height = 40
gameExit = False
y_change = 0
dodged = 0
if dodged==0:
pipe_speed = -2
while not gameExit:
if dodged>0:
pipe_speed = -2.5
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
y_change = -3
elif event.key == pygame.K_p:
time.sleep(4)
else:
y_change = 2
cubey += y_change
gameDisplay.fill(green)
pipe_draw(pipex, pipey, pipe_width, pipe_height, lel)
pipe_draw(pipex1, pipey1, pipe_width1, pipe_height1, lel)
pipe_draw(up_pipex, up_pipey, up_pipe_width, up_pipe_height, lel)
pipe_draw(up_pipex1, up_pipey1, up_pipe_width1, up_pipe_height1, lel)
cube_draw(cubex, cubey, cube_width, cube_height, red)
pipex += pipe_speed
pipex1 += pipe_speed
up_pipex += pipe_speed
up_pipex1 += pipe_speed
things_dodged(dodged)
###
if cubey < 0 or cubey > display_height - cube_height:
crash('You Hit The Side!')
if pipex < cubex + cube_width:
if display_height + pipe_height < cubey + cube_height or up_pipe_height > cubey:
crash('You Hit A Pipe!')
pipe_height10 = random.randint(30,550)
while pipe_height10 % 30 != 0:
pipe_height10 = random.randint(30,550)
pipe_height = pipe_height10 * -1
pipex += 1000
dodged += 1
up_pipe_height = display_height - (pipe_height * -1) - 120
up_pipex += 1000
if pipex1 < cubex + cube_width:
if display_height + pipe_height1 < cubey + cube_height or up_pipe_height1 > cubey:
crash('You Hit A Pipe!')
pipe_height11 = random.randint(30,550)
while pipe_height11 % 30 != 0:
pipe_height11 = random.randint(30,550)
pipe_height1 = pipe_height11 * -1
pipex1 += 1000
up_pipe_height1 = display_height - (pipe_height1 * -1) - 120
up_pipex1 += 1000
dodged += 1
pygame.display.update()
clock.tick(10000)
##############################################################################
game_loop()
`
EDIT:
A big thanks to @Martijn Pieters for answering this question