May-30-2023, 04:48 PM
(This post was last modified: May-30-2023, 04:48 PM by deanhystad.)
The problem is in the sequence.
1. Update everything
2. collision x - stops player from colliding with anything in X direction
3. collision y - stops player from colliding with anything in Y direction
4. Check for collisions between player and tiles. Guaranteed there are no collisions.
I also find it odd you put the treasure in the same group as the other tiles (walls and floors). How are you supposed to know that a collision is with treasure? This does not only check for Mesa objects.
1. Update everything
2. collision x - stops player from colliding with anything in X direction
3. collision y - stops player from colliding with anything in Y direction
4. Check for collisions between player and tiles. Guaranteed there are no collisions.
I also find it odd you put the treasure in the same group as the other tiles (walls and floors). How are you supposed to know that a collision is with treasure? This does not only check for Mesa objects.
for Mesa in self.tiles.sprites():The Mesa name is meaningles in this conext. It is just a variable and works the same if it is "a" instead of Mesa. The loop looks at all sprites. in the tiles group, not just sprites that are Mesa objects..