def __init__(self, pos, color): GameObject.__init__(self) self.position = pos self.size = Vector2(50, 10) self.rect = pygame.Rect(pos.x - 25, pos.y - self.size.y, 50, self.size.y) self.color = color self.collider = BoxCollider(self.rect)
def __init__(self, position, nextLevel): GameObject.__init__(self) self.name = "WinStar" self.nextlevel = nextLevel self.position = position self.image = pygame.image.load(os.path.join("images", "star.jpg")) self.rect = pygame.Rect(self.position.x - self.image.get_width() / 2, self.position.y - self.image.get_height() / 2, self.image.get_width(), self.image.get_height()) self.collider = BoxCollider(self.rect)
def __init__(self,position,nextLevel): GameObject.__init__(self) self.name = "WinStar" self.nextlevel = nextLevel self.position = position self.image = pygame.image.load(os.path.join("images","star.jpg")) self.rect = pygame.Rect(self.position.x-self.image.get_width()/2 ,self.position.y-self.image.get_height()/2 ,self.image.get_width() ,self.image.get_height()) self.collider = BoxCollider(self.rect)
def __init__(self, pos, size): GameObject.__init__(self) self.position.x = pos[0] self.position.y = pos[1] self.name = "Box" self.width = size[0] self.height = size[1] self.rect = pygame.Rect(self.position.x - self.width / 2, self.position.y - self.height, self.width, self.height) self.collider = BoxCollider(self.rect)
def __init__(self,pos,size): GameObject.__init__(self) self.position.x = pos[0] self.position.y = pos[1] self.name = "Box" self.width = size[0] self.height = size[1] self.rect = pygame.Rect(self.position.x - self.width/2 ,self.position.y - self.height ,self.width ,self.height) self.collider = BoxCollider(self.rect)
def __init__(self, pos, number, flip=False): GameObject.__init__(self) self.name = "Spikes" self.position = pos self.number = number self.flip = flip self.spikeWidth = 10 self.spikeHeight = 15 self.width = self.spikeWidth * number # Offset is 0 if the spikes are not flipped, otherwise 15, # so they'll be drawn in the right place. self.offset = self.spikeHeight * (not flip) self.rect = pygame.Rect(self.position.x - self.width / 2, self.position.y - self.offset, self.width, self.spikeHeight) self.collider = BoxCollider(self.rect)
def __init__(self,pos,number,flip=False): GameObject.__init__(self) self.name = "Spikes" self.position = pos self.number = number self.flip = flip self.spikeWidth = 10 self.spikeHeight = 15 self.width = self.spikeWidth * number # Offset is 0 if the spikes are not flipped, otherwise 15, # so they'll be drawn in the right place. self.offset = self.spikeHeight * (not flip) self.rect = pygame.Rect(self.position.x-self.width/2 ,self.position.y-self.offset ,self.width ,self.spikeHeight) self.collider = BoxCollider(self.rect)
def __init__(self): # Start out as a basic GameObject, then modify GameObject.__init__(self) self.name = "Player" self.color = (255,255,255) self.radius = 15 self.lineWidth = 3 self.movespeed = 3 self.startJumpspeed = 7 # Woop, colliders are awesome self.collider = CircleCollider(self.radius,self.position) # Sound effects pygame.mixer.quit() pygame.mixer.pre_init(44100, -16, 2) pygame.mixer.init() mpath = path.join("sound","bounce.ogg") self.bounce = pygame.mixer.Sound(mpath) self.onLoad()
def __init__(self): GameObject.__init__(self)
def __init__(self,first): GameObject.__init__(self) self.firstScene = first
def __init__(self, first): GameObject.__init__(self) self.firstScene = first