我正在玩游戏中的平台游戏,而且当我站在酸性瓷砖上时,我会陷入玩家应该跌倒的部分,但我一直有错误。 这是检查以下内容的代码:
def update(self, deltatime):
if not self.isShooting:
pass
self.image.update(deltatime)
self.rect = self.image.getScaledImage(self.scale).get_rect()
self.mask = pygame.mask.from_surface(self.image.getScaledImage(self.scale))
self.rect.x = 200
if self.isJumping or self.isFalling:
self.y += self.jumpVelocity * (deltatime / 1000.0)
self.jumpVelocity += self.jumpAcceleration * (deltatime / 1000.0)
if self.jumpVelocity > 0 and self.image != self.jump:
self.image = self.fall
elif self.jumpVelocity < 0 :
self.image = self.jump
if self.isSliding:
self.image = self.slide
if self.y < ground:
self.isFalling = True
self.isJumping = False
t = Tile(ground)
t.type = "acid"
if self.y > ground and t.type != "acid" and (pygame.sprite.collide_rect(player,t) == False):
print t.type
self.y = ground
self.isFalling = False
self.isJumping = False
#and Ground(acid=4).ground_tiles != "acid":
else:
pass
self.rect.y = self.y
def draw(self, screen):
if self.flip:
img = pygame.transform.flip(self.image.getScaledImage(self.scale), True, False)
else:
img = self.image.getScaledImage(self.scale)
#img_rect = img.get_rect()
screen.blit(img, (self.x, self.y))