我想制作碰撞检测脚本。在
当我运行脚本时Pygame总是说图像发生冲突。在
当我使用{"rect = cat1.img.get_rect()" then "rect.colliderect(another rect of other image)}时,它会打印出“crash”,而且这两种方法都是这样。在
我在两个精灵中使用了cat.png。在
问题
cat.png不好吗?在
我没有使用正确的脚本吗?在
我的电脑奇怪吗?在
这是我的脚本和cat.png。在
import pygame, sys, time
from pygame.locals import *
pygame.init()
Fps = 100
fpsClock = pygame.time.Clock()
Displaysurf = pygame.display.set_mode((300, 300))# full is 1900, 1000
pygame.display.set_caption('Animation')
white = (255, 255, 255)
class cat:
def __init__(self, x, y):
self.img = pygame.image.load('cat.png')
se