简体   繁体   English

精灵未在 Pygame 中绘制

[英]Sprite Not Drawn in Pygame

I'm new to Pygame and I don't understand why the sprite isn't being drawn on the screen.我是 Pygame 的新手,我不明白为什么没有在屏幕上绘制精灵。 Can someone show me how or what I'm doing wrong?有人可以告诉我我做错了什么或我做错了什么吗?

Here's my code:这是我的代码:

import pygame

pygame.display.set_caption('Platformer')

screen = pygame.display.set_mode((603, 480))

WHITE = (255, 255, 255)
x = "1"
y = "1"

loop = True
while loop:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            loop = False

def Player(Sprite):
    image=("Player.png")
    def __init__(self, image,  groups):
        pygame.update

screen.fill (WHITE)
Player(x, y)

pygame.quit()
quit()

Why the x and y is string???为什么 x 和 y 是字符串??? You are saying a position like a word.你说的是一个词的位置。 The type of pos must be int or float. pos 的类型必须是 int 或 float。

x = 1
y = 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM