Pygame kein Rechteck zeichnenPython

Python-Programme
Anonymous
 Pygame kein Rechteck zeichnen

Post by Anonymous »

Pygame funktioniert nicht
Pygame zeichnet keine Rechtecke oder andere Formen, die ich sehe.

Code: Select all

from setting import *
import pygame

class Game:
def __init__(self):
pass
def game(self):
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption(TITLE)
clock = pygame.time.Clock()
running = True
x=0
y=0
for row in MAP:
print(row)
for pos in row:
print(pos)
if pos == "x":
pygame.draw.rect(screen, [0, 0, 255], [x, y, 20, 20], 1)
x+=20
while running:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False

screen.fill(COLOR)
pygame.display.flip()
pygame.quit()
quit()

game = Game()
game.game()
< /code>
Zweite) Einstellung.py < /p>
FPS = 60
WIDTH = 800
HEIGHT = 600
COLOR = [255,255,255]
TITLE = 'test'

MAP = [['x', 'x', 'x','x','x', 'x', 'x','x','x', 'x', 'x','x']
,['x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x']
,['x', ' ', ' ', 'P', ' ', ' ', ' ', ' ', ' ', ' ', 'x']
,['x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x']
,['x', 'x', 'x','x','x', 'x', 'x','x','x', 'x', 'x','x']
]

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post