相关疑难解决方法(0)

Pygame图像位置

我最近开始使用pygame看看我能想出什么并遇到一个问题,如果没有这个pygame.sprite.Sprite和rect事情,我找不到答案,我的问题是如何找到一个位置因为我需要它的位置来计算旋转角度.如果它有帮助,这是我正在使用的代码:

import sys, pygame, math, time;
from pygame.locals import *;
spaceship = ('spaceship.png')
mouse_c = ('crosshair.png')
backg = ('background.jpg')
fire_beam = ('beam.png')
pygame.init()
screen = pygame.display.set_mode((800, 600))
bk = pygame.image.load(backg).convert_alpha()
mousec = pygame.image.load(mouse_c).convert_alpha()
space_ship = pygame.image.load(spaceship).convert_alpha()
f_beam = pygame.image.load(fire_beam).convert_alpha()
clock = pygame.time.Clock()
pygame.mouse.set_visible(False)
space_ship_rect = space_ship.get_rect() #added
while True:
screen.blit(bk, (0, 0))
for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        sys.exit()
    elif event.type == MOUSEBUTTONDOWN and event.button == 1:
        print("Left Button Pressed")
    elif event.type == MOUSEBUTTONDOWN and event.button == …
Run Code Online (Sandbox Code Playgroud)

python pygame

0
推荐指数
1
解决办法
3万
查看次数

标签 统计

pygame ×1

python ×1