import pygame class Portal: def __init__(self, x, y): self.x = x self.y = y def isPointOnPortal(self, x, y): xIsInBetween = self.x - 10 <= x and x <= self.x + 10 yIsInBetween = self.y - 10 <= y and y <= self.y + 10 return xIsInBetween and yIsInBetween def draw(self, screen): pygame.draw.rect( screen, # Surface (0, 255, 0), # Colour (self.x - 10, self.y - 10, 20, 20) # left, top, width, height )