You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bom dia, ao fechar o jogo aparecem alguns erros, o que devo fazer para corrigi-los?
Os erros são os seguintes: Traceback (most recent call last): File "c:\Users\ESHM\Desktop\Pedro_18\jogopong.py", line 103, in <module> atualizar() File "c:\Users\ESHM\Desktop\Pedro_18\jogopong.py", line 59, in atualizar keys = pygame.key.get_pressed() pygame.error: video system not initialized
O meu código tem algumas alterações que fiz, mas apenas em alguns tamanhos e valores, aqui está o código:
`from pygame import DOUBLEBUF
import pygame
from pygame.locals import *
from OpenGL.GL import *
import time
Bom dia, ao fechar o jogo aparecem alguns erros, o que devo fazer para corrigi-los?
Os erros são os seguintes:
Traceback (most recent call last): File "c:\Users\ESHM\Desktop\Pedro_18\jogopong.py", line 103, in <module> atualizar() File "c:\Users\ESHM\Desktop\Pedro_18\jogopong.py", line 59, in atualizar keys = pygame.key.get_pressed() pygame.error: video system not initialized
O meu código tem algumas alterações que fiz, mas apenas em alguns tamanhos e valores, aqui está o código:
`from pygame import DOUBLEBUF
import pygame
from pygame.locals import *
from OpenGL.GL import *
import time
largura_janela = 640
altura_janela = 480
xDaBola = 0
yDaBola = 0
tamanhoDaBola = 20
velocidadeDaBolaEmX = 0.20
velocidadeDaBolaEmY = 0.20
yDoJogador1 = 0
yDoJogador2 = 0
def xDoJogador1():
return -largura_janela / 2 + larguraDosJogadores() / 2
def xDoJogador2():
return largura_janela / 2 - larguraDosJogadores() / 2
def larguraDosJogadores():
return tamanhoDaBola
def alturaDosJogadores():
return 3 * tamanhoDaBola
def atualizar():
global xDaBola, yDaBola, velocidadeDaBolaEmX, velocidadeDaBolaEmY, yDoJogador1, yDoJogador2, xDoJogador2, xDoJogador1, tamanhoDaBola, largura_janela, altura_janela, larguraDosJogadores
def desenharRetangulo(x, y, largura, altura, r, g, b):
glColor3f(r, g, b)
def desenhar():
glViewport(0, 0, largura_janela, altura_janela)
pygame.init()
pygame.display.set_mode((largura_janela, altura_janela), DOUBLEBUF | OPENGL)
while True:
atualizar()
desenhar()
pygame.event.pump()
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
#pygame.event.pump()`
Desculpe se fiz alguma coisa mal, ainda estou a aprender a utilizar o github e python
The text was updated successfully, but these errors were encountered: