import pygame
#intialize the pygame
pygame.init()
# create the screen
screen = pygame.display.set_mode((800,600))
# Title and Icon
pygame.display.set_caption("Space Invader")
icon = pygame.image.load('spaceship (1).png')
pygame.display.set_icon(icon)
# Player
playerImg = pygame.image.load('ship.png.png')
playerX = 400
playerY = 490
def player(x,y):
screen.blit(playerImg,(x,y))
# game Loop
running = True
while running:
# RGB - Red,Green,Blue
screen.fill((0,0))
playerX += .1
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
player(playerX,playerY)
pygame.display.update()
我试图找出将playerX移到屏幕上的问题是什么?我想移动playerX + = .1,但出现错误?
•
问答