Walls in Pygame
问题 I am trying to make a simple Pac-Man game in Pygame, but I don't know how to make walls. How I can make check if player hit a wall when it moves? This is the code of main.py : # Imports import pygame import sys import player import room # Colors black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) blue = (0, 255, 0) green = (0, 0, 255) # Global variables S_WIDTH = 800 S_HEIGHT = 800 FPS = 60 # player speed SPEED = 2 WALLS = pygame.sprite.Group() # Initialization pygame.init() screen =