collision

Player collision with tiles not working, instead falling through them

Player collision with tiles not working, instead falling through them Question: Basically I’m learning pygame. and I’m learning from a tutorial, I’m not doing 100% the same but mostly, now I can’t figure out why the tutorial works and mine doesn’t, in terms of colliding with tiles. Here’s my code: import sys import pygame clock …

Total answers: 1

How do I "Push" an object (crate) with another object (player) in Pygame?

How do I "Push" an object (crate) with another object (player) in Pygame? Question: I’m trying to make a pushable crate using Pygame. I’m able to push the crate in all directions (up, down, left and right) which works fine. I can also push the crate up or down and move left and right at …

Total answers: 1

Why is my colliderect() not working correctly?

Why is my colliderect() not working correctly? Question: Collision reacts to nothing, as if the platforms have shifted to the right. I am using it for the first time, so I would like an answer with an additional explanation… def collision(self, j): self.player_rect = pg.Rect(self.playerx, self.playery, player_w, player_h) for i in range(len(self.platfsx)): if self.player_rect.colliderect(pg.Rect(self.platfsx[i], self.platfsy[i], …

Total answers: 2

collision issue with pygame in python3 using tiled

collision issue with pygame in python3 using tiled Question: im working on a litle game using pygame in python3. Im using tiled for the map and pyscroll for the camera and i don’t know how to solve this issue: i made detection collision that work using object layer in tiled and a litle bit of …

Total answers: 1

problem when rectangles collide in pygame

problem when rectangles collide in pygame Question: I’m trying to make a simple game but I’m stuck because when the two rectangles collide the lives are supposed to go down one by one, I’m pretty sure it’s because of the pixels but I still don’t know how to fix it. Am I supposed to change …

Total answers: 1

How do I make a pygame.draw.rect detect collision with a pygame.surface?

How do I make a pygame.draw.rect detect collision with a pygame.surface? Question: The title basically explain it all. Here’s the code for the pygame.draw.rect: stand = pygame.draw.rect(screen, green, (spike_x + 900, 400 – player_y + 476, 500, 500), border_radius=15) I want the stand to be able to collide with the player. The player is using …

Total answers: 1