def __init__(self): self.loader = Loader() self.img = self.loader.load_image("mouse.png", True) self.moving = False self.visible = False self.pos = vec2d(400.0, 300.0) self.to_pos = vec2d(400.0, 300.0) self.heading = vec2d(1.0, 0.0) self.dist = 0
def __init__(self): self.loader = Loader() self.img = self.loader.load_image("mouse.png",True) self.moving = False self.visible = False self.pos = vec2d(400.0,300.0) self.to_pos = vec2d(400.0,300.0) self.heading = vec2d(1.0,0.0) self.dist = 0
def __init__(self,img,pos): self.img = img x,y = pos self.pos = vec2d(float(x),float(y)) self.speed = vec2d(1.0,0.0) self.speed.length = float(random.randint(1,3)) self.speed.angle = random.randint(0,359) self.g = vec2d(0.0,0.1) self.count = 50
def __init__(self, pos_init, speed, SCREEN_WIDTH, SCREEN_HEIGHT): pygame.sprite.Sprite.__init__(self) self.pos = vec2d(pos_init) self.speed = speed self.width = int(SCREEN_WIDTH * 0.1) #default = 0.2 image = pygame.Surface((self.width, SCREEN_HEIGHT * 1.5)) image.fill((0, 0, 0, 0)) image.set_colorkey((0, 0, 0)) color = (120, 240, 80) # top rect pygame.draw.rect(image, (WHITE), (0, 0, self.width, SCREEN_HEIGHT * 0.5), 0) # bot rect pygame.draw.rect( image, (WHITE), (0, SCREEN_HEIGHT * 1.05, self.width, SCREEN_HEIGHT * 0.5), 0) self.image = image self.rect = self.image.get_rect() self.rect.center = pos_init
def goto(self,pos): self.to_pos = vec2d(float(pos[0]),float(pos[1])) self.visible = True self.moving = True self.heading = self.to_pos - self.pos self.dist = self.heading.length self.heading.length = 12.0
def goto(self, pos): self.to_pos = vec2d(float(pos[0]), float(pos[1])) self.visible = True self.moving = True self.heading = self.to_pos - self.pos self.dist = self.heading.length self.heading.length = 12.0
def __init__(self, pos_init, speed, SCREEN_WIDTH, SCREEN_HEIGHT): pygame.sprite.Sprite.__init__(self) self.pos = vec2d(pos_init) self.width = int(SCREEN_WIDTH * BLOCK_WIDTH_COEFFICIENT) self.height = int(SCREEN_HEIGHT * BLOCK_HEIGHT_COEFFICIENT) self.speed = speed self.SCREEN_WIDTH = SCREEN_WIDTH self.SCREEN_HEIGHT = SCREEN_HEIGHT image = pygame.Surface((self.width, self.height)) image.fill((0, 0, 0, 0)) image.set_colorkey((0, 0, 0)) pygame.draw.rect(image, GREY, (0, 0, self.width, self.height), 0) self.image = image self.rect = self.image.get_rect() self.rect.center = pos_init
def __init__(self, speed, SCREEN_WIDTH, SCREEN_HEIGHT): pygame.sprite.Sprite.__init__(self) helicopter = pygame.image.load("images/helicopter_tiny.png") pos_init = (int(SCREEN_WIDTH * 0.35), SCREEN_HEIGHT / 2) self.pos = vec2d(pos_init) self.speed = speed if arguments.mode == "flappy": self.climb_speed = speed * -0.875 # -0.0175 self.fall_speed = speed * 0.09 # 0.0019 else: self.climb_speed = speed * -0.09 self.fall_speed = speed * 0.09 self.momentum = 0 self.width = SCREEN_WIDTH * PLAYER_WIDTH_COEFFICIENT self.height = SCREEN_HEIGHT * PLAYER_HEIGHT_COEFFICIENT image = pygame.Surface((2 * self.width, 1.5 * self.height)) image.fill((0, 0, 0, 0)) image.set_colorkey((0, 0, 0)) # pygame.draw.rect( # image, # WHITE, # (0, 0, self.width, self.height), # 0 # ) image.blit(helicopter, (0, 0)) self.image = image self.rect = self.image.get_rect() self.rect.center = pos_init