0

Here's my current code and the spritesheets that I'm using Player, Fence.
I'm trying to add collisions to my sprites and I've tried three different ways

  • I first tried using normal rects for my sprites. Normal Rect Collision.
    I can't move up anymore since the player sprite has a lot of space above it's head

  • I then tried Masks but the player sprite gets stuck in between the fences. Mask Collision.
    and now the player can't move up or down and has to move away (left) to free themself

  • I found out about bounding rects and it did kinda solve the first problem but Bounding Rect Collision.
    I'm not sure if this is the right answer but the "fence's" rect is at the topleft of the sprite but the fence's graphics are somewhere more to the right. I did try using

self.image = self.image.subsurface(self.rect)

Which works on the player, but doing it on the fence caused a weird glitch Glitch.
I'm not trying to get pixel perfect collisions, but I am trying to minimize the space between the collisions.

0 Answers0