python - Pygame collision with static player -


i'm creating game players character stays in centre of screen , surrounding walls change position instead, many top-down games.

my issue have list of walls pygame.rects cannot figure out way make collisions works correctly static player. have variables so

walls = [pygame.rect([0, 0, 20, 20]), ...] player = pygame.rect([100, 100, 20, 20]) 

where walls contains walls of current level. how make when player collides 1 of these rects adjusts correctly , stops other walls moving well. position of players rect never changes , hence must [100, 100] walls positions change.

don't move walls. move player. when draw game objects, subtract coordinates of player , add (100, 100) give appearance of player not moving. game model should represent actual state of game, , rendering considerations should occur @ render time only. .


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -