def __init__(self):
        Sprite.__init__(self)
        self.original_image = common.load('presents/gcoop.png', False)
        self.image = self.original_image
        self.alpha = 0
        self.rect = self.image.get_rect()
        self.rect.centerx = 1260 / 2
        self.center = self.rect.center
        self.y = 90
        w, h = self.image.get_width(), self.image.get_height()
        self.width = 0
        self.height = 0

        common.tweener.addTween(self,
                                width=w,
                                tweenTime=1700,
                                tweenType=pytweener.Easing.Elastic.easeInOut)
        common.tweener.addTween(self,
                                height=h,
                                tweenTime=1800,
                                tweenType=pytweener.Easing.Elastic.easeInOut)
        common.tweener.addTween(self,
                                alpha=255,
                                tweenTime=500,
                                tweenType=pytweener.Easing.Linear.easeNone)
        self.update()
示例#2
0
 def __init__(self, window, x=0, y=0):
     Sprite.__init__(self, window)
     self.setDimensions(15, 120)
     self.setPOS(50, self.window.getHeight() / 2 - self.height / 2)
     self.sprite.fill(self.rcolor)
     self.spd = 10
     self.con = False
示例#3
0
    def __init__(self):
        Sprite.__init__(self)
        self.pos=[0,0,5] #like every other thing, pos is at center bottom

        self.speed=[0,0,0]
        self.size=2 #ball radius, for goal accuracy (used in y, and 2* in z)
        self.owner=0 #0 if ball is free

        self.anim_index=0
        self.direction=1# +1: right, -1: left  TODO : add more directions ?
        self.state="roll1"
        
        self.anim={}#dictionnary for left and right
        self.anim[1]={} #dictionnary of all animation looking to the right
        self.anim[1]["roll1"]=[]
        self.anim[1]["roll1"].append(pygame.image.load("data/_ball_roll1_A.png"))
        self.anim[1]["roll1"].append(pygame.image.load("data/_ball_roll1_B.png"))
        self.anim[1]["roll1"].append(pygame.image.load("data/_ball_roll1_C.png"))
        self.anim[1]["roll1"].append(pygame.image.load("data/_ball_roll1_D.png"))
        self.anim[1]["roll1"].append(pygame.image.load("data/_ball_roll1_E.png"))
        self.anim[1]["roll1"].append(pygame.image.load("data/_ball_roll1_F.png"))
        
        #flip all anims to look left
        self.anim[-1]={}
        for key in self.anim[1]:
            self.anim[-1][key]=[]
            for img in self.anim[1][key]:
                self.anim[-1][key].append(pygame.transform.flip(img, 1, 0))
        
        self.image = self.anim[self.direction][self.state][int(self.anim_index)] #this is how we get the current picture
示例#4
0
文件: nubes.py 项目: gcoop-libre/ayni
 def __init__(self, imagen, velocidad):
     self.image = imagen
     Sprite.__init__(self)
     self.rect = self.image.get_rect()
     self.x = random.randint(-50, int(config.WIDTH))
     self.rect.y = random.randint(-20, int(config.HEIGHT * 0.9))
     self.velocidad = velocidad
示例#5
0
文件: player.py 项目: adirksen/Python
 def __init__(self, world, obj):
     if obj.gid is None:
         print >>sys.stderr, 'Player: must be created from tile object'
         sys.exit(1)
     self.left=False
     self.world = world
     self.gid = obj.gid
     tile = world.data.tiles[self.gid]
     Sprite.__init__(self,
             world,
             obj.kind,
             '{} ({},{})'.format(obj.kind, obj.x, obj.y),
             tile.get_width(), tile.get_height(),
             obj.x, obj.y,
             (16.0, 16.0))
     self.addForce('friction', (1.0, 0.0), 'slowdown')
     self.addForce('gravity', (0.0, 1.0), 'constant')
     self.count = 0
     self.coins = 0
     pygame.font.init()
     self.font = pygame.font.SysFont("Helvetica", 36)
     self.font2 = pygame.font.SysFont("Courier New", 20)
     self.text_color = (255,255,255)
     self.score_color = (255, 0, 0)
     self.score_x = 10
     self.score_y = 30
     self.game_x = 230
     self.game_y = 240
     self.coins = 0
     self.lives = 3
     self.newlife = 0
     self.hurt = False
     self.active = True
示例#6
0
 def __init__(self, world_map, GRID_LOCK, coordinates=None):
     Sprite.__init__(self, world_map, self.sprite_image, GRID_LOCK,
                     coordinates)
     self.type = "deer"
     self.movable_terrain = world_map.get_all_land_tile_types()
     self.predators = ["wolf"]
     self.prey = ["plant"]
示例#7
0
 def __init__(self, world, obj):
     pygame.mixer.init(44100, -16, 2, 2048)
     if obj.gid is None:
         print >> sys.stderr, 'Player: must be created from tile object'
         sys.exit(1)
     self.left = False
     self.world = world
     self.gid = obj.gid
     tile = world.data.tiles[self.gid]
     Sprite.__init__(self, world, obj.kind,
                     '{} ({},{})'.format(obj.kind, obj.x,
                                         obj.y), tile.get_width(),
                     tile.get_height(), obj.x, obj.y, (16.0, 16.0))
     self.addForce('friction', (1.0, 0.0), 'slowdown')
     self.addForce('gravity', (0.0, 1.0), 'constant')
     self.count = 0
     self.coins = 0
     pygame.font.init()
     self.hurtSound = pygame.mixer.Sound('OOT_AdultLink_Hurt1.wav')
     self.jumpSound = pygame.mixer.Sound('OOT_AdultLink_Jump1.wav')
     self.jewelSound = pygame.mixer.Sound('LOZ_Get_Rupee.wav')
     self.dieSound = pygame.mixer.Sound('LA_Link_Dying.wav')
     self.font = pygame.font.SysFont("Times New Roman", 36)
     self.font2 = pygame.font.SysFont("Courier New", 20)
     self.text_color = (255, 225, 225)
     self.score_color = (255, 0, 0)
     self.score_x = 10
     self.score_y = 30
     self.game_x = 230
     self.game_y = 240
     self.coins = 0
     self.lives = 3
     self.newlife = 0
     self.hurt = False
     self.active = True
示例#8
0
    def __init__(self, text="", fontname=None, size=32):
        self.font = Font(fontname or pygame.font.get_default_font(), size)

        Sprite.__init__(self, None)
        self.text = text
        self.color = (0, 0, 0)
        self.set_text(text)
示例#9
0
    def __init__(self, x, y, w, h, vel_x, vel_y, vel, lado, cor, imagem):

        Entidade.__init__(self, x, y, w, h, vel_x, vel_y, vel)
        Sprite.__init__(self, imagem, cor)

        self.__cor = cor
        self.lado = lado
        self.ativo = True
示例#10
0
 def __init__(self, level, pos, facing):
     Sprite.__init__(self, level, pos, facing)
     
     level.destructibles.add(self)
     level.solids.add(self)
     
     self.tile = 2, 2
     self.rotate = True
示例#11
0
文件: room.py 项目: derrida/shmuppy
 def __init__(self, scene):
     color = (43,73,85)
     grid_color = (170,170,170)
     self.size = (16,16)
     Sprite.__init__(self, scene, self.size, color)
     if config.DEBUG:
         offset = self.rect.move([1,1])
         draw.rect(self.image, grid_color, offset, 1)
示例#12
0
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('presents/presents.png', False)
     self.rect = self.image.get_rect()
     self.rect.centerx = 1280 / 2
     self.rect.y = 600
     self.alpha = 0
     self.update()
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('continue.png', True)
     self.rect = self.image.get_rect()
     self.y = 720 + self.rect.h
     self.rect.bottom = self.y
     self.rect.centerx = 1280 / 2
     common.tweener.addTween(self, y=710, tweenTime=1700)
示例#14
0
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('presents/presents.png', False, (config.WIDTH * 0.3, 0))
     self.rect = self.image.get_rect()
     self.rect.centerx = config.WIDTH / 2
     self.rect.y = config.HEIGHT * 0.8
     self.alpha = 0
     self.update()
示例#15
0
文件: energy.py 项目: HieuLsw/sbfury
 def __init__(self, x, y, w, h):
     Sprite.__init__(self, x, y)
     self.model = None
     self.w = w
     self.image = pygame.Surface((w + 2, h))
     self.rect = self.image.get_rect().move(x, y)
     self.z = -1000
     self.collision_rect = None
示例#16
0
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('continue.png', True, (config.WIDTH * 0.7, 0))
     self.rect = self.image.get_rect()
     self.y = config.HEIGHT + self.rect.h
     self.rect.bottom = self.y
     self.rect.centerx = config.WIDTH / 2
     common.tweener.addTween(self, y=self.y * 0.8, tweenTime=1700)
示例#17
0
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('title.png', True, (config.WIDTH * 0.3, 0))
     self.rect = self.image.get_rect()
     self.rect.right = config.WIDTH * 0.9
     self.y = config.HEIGHT
     common.tweener.addTween(self, y=self.y * 0.05, tweenTime=1700, 
             tweenType=pytweener.Easing.Elastic.easeInOut)
示例#18
0
文件: room.py 项目: derrida/shmuppy
 def __init__(self, scene):
     color = (0,0,0)
     room_size = config.RESOLUTION
     self.tile = FloorTile(scene)
     self.num_tiles = [
         config.RESOLUTION[0] / self.tile.size[0],
         config.RESOLUTION[1] / self.tile.size[1] ]
     Sprite.__init__(self, scene, room_size, color)
     self.make_floor()
示例#19
0
 def __init__(self, scene, size, color, name, speed, hp):
     Sprite.__init__(self, scene, size, color)
     self.name = name
     self.speed = speed
     self.hp = hp
     self.weapon_id = 0
     self.weapon = scene.weapon_list[self.weapon_id]
     self.firing = False
     self.last_fired = 0
示例#20
0
 def __init__(self, stage_objects=[]):
     Sprite.__init__(self)
     pygame.mouse.set_visible(False)
     self._load_frames()
     self.show()
     self.set_frame('normal')
     self.rect = self.image.get_rect()
     self.stage_objects = stage_objects
     self.z = -50
示例#21
0
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('level_complete.png', True, (config.WIDTH * 0.5, 0))
     self.rect = self.image.get_rect()
     self.rect.centerx = config.WIDTH / 2
     self.y = -self.rect.h * 2
     self.rect.y = self.y
     common.tweener.addTween(self, y=config.HEIGHT * 0.4, tweenTime=1700, 
             tweenType=pytweener.Easing.Elastic.easeInOut)
示例#22
0
 def __init__(self, window, x=0, y=0):
     Sprite.__init__(self, window)
     self.setDimensions(30, 30)
     self.setPOS(self.window.getWidth()/2 - self.width/2, self.window.getHeight()/2 - self.height/2)
     self.sprite.fill(self.color)
     self.spdx = 10
     self.spdy = 10
     self.p1score = 0
     self.p2score = 0
示例#23
0
 def __init__(self, level, pos, facing=0):
     Sprite.__init__(self, level, pos, facing)
     
     level.movables.add(self)
     level.solids.add(self)
     
     self.layer = 1
     
     self.is_sinkable = True
     self.moves_continuously = False
示例#24
0
文件: energy.py 项目: HieuLsw/sbfury
 def __init__(self, x, y, font):
     Sprite.__init__(self, x, y)
     self.background = common.load_image("energy_view.png")
     self.model = None
     self.font = font
     self.image = self.background.convert_alpha()
     self.rect = self.image.get_rect()
     self.to_y = y
     self.rect.move_ip(x, y)
     self.rect.y = -50
示例#25
0
    def __init__(self, imgs):

        Sprite.__init__(self, imgs[0])

        self.__state = -1
        self.__states = list()

        self.__states = imgs

        self.state = ImageButton.NORMAL
示例#26
0
 def __init__(self, level, pos, facing=0):
     Sprite.__init__(self, level, pos, facing)
     
     level.destructibles.add(self)
     level.solids.add(self)
     
     self.tile = 1, 2
     self.facing = 2
     self.layer = 1
     self.rotate = True
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('title.png', True)
     self.rect = self.image.get_rect()
     self.rect.right = 1180
     self.y = 780
     common.tweener.addTween(self,
                             y=40,
                             tweenTime=1700,
                             tweenType=pytweener.Easing.Elastic.easeInOut)
示例#28
0
 def __init__(self, level, pos, facing):
     Sprite.__init__(self, level, pos, facing)
     
     level.destructibles.add(self)
     level.enemies.add(self)
     level.solids.add(self)
     
     self.layer = 1
     self.speed = 250
     self.rotate = True
 def __init__(self):
     Sprite.__init__(self)
     self.image = common.load('level_complete.png', True)
     self.rect = self.image.get_rect()
     self.rect.centerx = 1280 / 2
     self.y = -self.rect.h
     common.tweener.addTween(self,
                             y=300,
                             tweenTime=1700,
                             tweenType=pytweener.Easing.Elastic.easeInOut)
示例#30
0
    def __init__(self, posX=0, posY=0, velX=0, velY=0, type="TrainCell"):
        Sprite.__init__(self,posX,posY)
        self.width=DEFAULT_WIDTH
        self.height=DEFAULT_HEIGHT
        self.maxHp=100
        self.hp=self.maxHp
        self.isDead=False

        self.baseVelX=0
        self.baseVelY=0
        self.velX=velX
        self.velY=velY

        self.deltaTransX=0.1
        self.deltaTransY=0.1
        self.transVelX=velX
        self.transVelY=velY

        self.destination=random.randint(150,700-self.width)

        self.type=type
        self.name="Cell"
        #rotation
        self.deltaRot=0.05
        self.transDeltaRot=0.05
        self.deltaDeltaRot=0.0005
        self.rotDirection=-1
        self.rot=0
        self.status=None

        self.shield=random.randint(0,150)

        self.deltaTransShield=1
        self.transShield=self.shield

        #movement
        self.degreeRot=0
        self.deltaDegreeRot=random.random()/15

        #effects
        self.dyingParticles=[]

        #available
        self.isAvailable=True

        #attributes
        self.outerShape=random.choice(OUTER_SHAPE_LIST)
        self.outerColor,self.outerColorList=random.choice(COLOR_LIST)
        self.outerRotation,self.outerRotationVal=random.choice(ROT_DIRECTION_LIST)
        
        self.innerShape=random.choice(INNER_SHAPE_LIST)
        if self.innerShape=="None":
            self.innerColor,self.innerColorList=("Black",[0,0,0])
        else:
            self.innerColor,self.innerColorList=random.choice(COLOR_LIST)
示例#31
0
    def __init__(self, posX=0, posY=0, velX=0, velY=0, type="TrainCell", caracteristicas="00000"):
        Sprite.__init__(self,posX,posY)
        self.width=DEFAULT_WIDTH
        self.height=DEFAULT_HEIGHT
        self.maxHp=200
        self.hp=self.maxHp
        self.isDead=False

        
        self.velX=velX
        self.velY=velY

        self.baseVelX=velX
        self.baseVelY=0

        self.deltaTransX=0.05
        self.deltaTransY=0.05
        self.transVelX=velX
        self.transVelY=velY

        self.type=type
        self.name="Cell"
        #rotation
        self.deltaRot=0.05
        self.transDeltaRot=0.05
        self.deltaDeltaRot=0.0005
        self.rotDirection=-1
        self.rot=0
        self.status=None

        self.characteristics = caracteristicas


        #movement
        self.degreeRot=0
        self.deltaDegreeRot=random.random()/15

        #effects
        self.dyingParticles=[]

        #attributes
#        self.outerShape=random.choice(OUTER_SHAPE_LIST)
        self.outerShape = OUTER_SHAPE_LIST[int(self.characteristics[0])]
#        self.outerColor,self.outerColorList=random.choice(COLOR_LIST)
        self.outerColor, self.outerColorList = COLOR_LIST[int(self.characteristics[1])]
#        self.outerRotation,self.outerRotationVal=random.choice(ROT_DIRECTION_LIST)
        self.outerRotation,self.outerRotationVal=ROT_DIRECTION_LIST[int(self.characteristics[2])]
        
#        self.innerShape=random.choice(INNER_SHAPE_LIST)
        self.innerShape=INNER_SHAPE_LIST[int(self.characteristics[3])]
        if self.innerShape=="None":
            self.innerColor,self.innerColorList=("Black",[0,0,0])
        else:
#            self.innerColor,self.innerColorList=random.choice(COLOR_LIST)
            self.innerColor,self.innerColorList=COLOR_LIST[int(self.characteristics[4])]
示例#32
0
 def __init__(self, level, pos, facing):
     Sprite.__init__(self, level, pos, facing)
     
     level.destructibles.add(self)
     level.solids.add(self)
     
     self.tile = 4, 1
     self.layer = 3
     self.rotate = True
     
     self.beams = pygame.sprite.Group()
示例#33
0
 def __init__(self, stage_objects):
     Sprite.__init__(self)
     pygame.mouse.set_visible(False)
     self._load_frames()
     self.show()
     self.set_frame('normal')
     self.rect = self.image.get_rect()
     self.stage_objects = stage_objects
     self.change_state(mouse_state.Normal(self))
     self.z = -50
     self.selected_player = None
示例#34
0
 def __init__(self,posX=0, posY=0, velX=0, velY=0, size=0.14, lifetime=0):
     Sprite.__init__(self,posX, posY)
     self.width=random.randint(MIN_SIZE,MAX_SIZE)
     self.height=self.width
     self.velY=velX
     self.velX=velY
     self.size=size
     if lifetime==0:
         self.lifeTime=random.randint(200,300)
     else:
         self.lifeTime=lifetime
示例#35
0
文件: mouse.py 项目: gcoop-libre/ayni
 def __init__(self, stage_objects):
     Sprite.__init__(self)
     #pygame.mouse.set_visible(False)
     self._load_frames()
     self.show()
     self.set_frame('normal')
     self.rect = self.image.get_rect()
     self.stage_objects = stage_objects
     self.change_state(mouse_state.Normal(self))
     self.z = -50
     self.selected_player = None
示例#36
0
文件: pipe.py 项目: gcoop-libre/ayni
 def __init__(self, game, type, x, y, map):
     Sprite.__init__(self)
     self.type = type
     self.image = common.load('front_pipes/%d.png' %(type), True, (config.BLOCK_SIZE, config.BLOCK_SIZE))
     self.rect = self.image.get_rect()
     self.map = map
     self.can_be_clicked = True
     self.x = x - self.rect.w / 2
     self.y = y - self.rect.h
     self.are_in_a_placeholder = False
     self.z = -10
     self.game = game
示例#37
0
 def __init__(self, world, obj):
     if obj.gid is None:
         print >> sys.stderr, 'Coin: must be created from tile object'
         sys.exit(1)
     self.world = world
     self.gid = obj.gid
     tile = world.data.tiles[self.gid]
     self.count = 0
     Sprite.__init__(self, world, obj.kind,
                     '{} ({},{})'.format(obj.kind, obj.x,
                                         obj.y), tile.get_width(),
                     tile.get_height(), obj.x, obj.y, (0.0, 0.0))
示例#38
0
 def __init__(self, game, type, x, y, map):
     Sprite.__init__(self)
     self.type = type
     self.image = common.load('front_pipes/%d.png' % (type), True)
     self.rect = self.image.get_rect()
     self.map = map
     self.can_be_clicked = True
     self.x = x - self.rect.w / 2
     self.y = y - self.rect.h
     self.are_in_a_placeholder = False
     self.z = -10
     self.game = game
示例#39
0
文件: object.py 项目: HieuLsw/sbfury
    def __init__(self, stage=None):
        Sprite.__init__(self)
        self.z = 0
        self.unset_collision()
        self.sensitive = True       # indica si es sensible a las colisiones
        self.stage = stage
        self.live = True

        if stage:
            self.move = self.move_with_stage
        else:
            self.move = self.move_without_stage
示例#40
0
    def __init__(self,
                 x,
                 y,
                 w,
                 h,
                 vel_x=0,
                 vel_y=0,
                 vel=1,
                 cor=(200, 0, 150),
                 imagem=None):

        Entidade.__init__(self, x, y, w, h, vel_x, vel_y, vel)
        Sprite.__init__(self, imagem, cor, 100, 204, 0.7)
        self.__ativo = True
示例#41
0
    def __init__(self, text_image, x, y):
        Sprite.__init__(self)
        self.image = common.load('balloon.png', True)
        self.rect = self.image.get_rect()
        self.rect.right = x + 70
        self.rect.bottom = y
        self.time_to_live = 150
        self.image.blit(text_image, (5, 5))

        # Evita que el cuadro de dialogo salga de la pantalla
        if self.rect.left < 2:
            self.rect.left = 2
        elif self.rect.right > 638:
            self.rect.right = 638
示例#42
0
    def __init__(self, text_image, x, y):
        Sprite.__init__(self)
        self.image = common.load('balloon.png', True, (config.WIDTH * 0.13, 0))
        self.rect = self.image.get_rect()
        self.rect.right = x + int(config.WIDTH * 0.058)
        self.rect.bottom = y
        self.time_to_live = 150
        self.image.blit(text_image, (5, 5))

        # Evita que el cuadro de dialogo salga de la pantalla
        if self.rect.left < 2:
            self.rect.left = 2
        elif self.rect.right > config.WIDTH - 2:
            self.rect.right = config.WIDTH - 2
示例#43
0
文件: virus.py 项目: tucif/Biokterii
    def __init__(self, posX=0, posY=0):
        Sprite.__init__(self, posX, posY)
        self.width = DEFAULT_WIDTH
        self.height = DEFAULT_HEIGHT
        self.color = (0.3, 0.6, 0.5)
        self.maxHp = 1000

        self.hp = self.maxHp
        self.deltaHp = 1
        self.transHp = self.hp

        self.isDead = False
        self.velX = 0.0
        self.velY = 0.0
示例#44
0
	def __init__(self, position, team = 0):
		Sprite.__init__(self, position)
		self.addAnimation("stand", content.images['player3.png'],	32 * 0 , 0, 32, 32, 1, 0, True)
		self.addAnimation("runf", content.images['player3.png'],	32 * 1 , 0, 32, 32, 6, 9, True)
		self.addAnimation("runfh", content.images['player3.png'],	32 * 7 , 0, 32, 32, 6, 9, True)
		self.addAnimation("runb", content.images['player3.png'],	32 * 13, 0, 32, 32, 6, 9, True)
		self.addAnimation("runbh", content.images['player3.png'],	32 * 19, 0, 32, 32, 6, 9, True)
		self.addAnimation("catch", content.images['player3.png'],	32 * 25, 0, 32, 32, 1, 0, True)
		self.addAnimation("throw", content.images['player3.png'],	32 * 26, 0, 32, 32, 4, 7, True)
		self.addAnimation("hit", content.images['player3.png'],		32 * 30, 0, 32, 32, 2, 4, True)
		self.addAnimation("jumpf", content.images['player3.png'],	32 * 32, 0, 32, 32, 1, 0, True)
		self.addAnimation("jumpfh", content.images['player3.png'],	32 * 33, 0, 32, 32, 1, 0, True)
		self.addAnimation("jump", content.images['player3.png'],	32 * 34, 0, 32, 32, 1, 0, True)
		self.addAnimation("jumph", content.images['player3.png'],	32 * 35, 0, 32, 32, 1, 0, True)

		self.team = team

		self.name = "player"
		self.shadowSize = 19
		self.shadowOffset = Vector2(0, 1)

		self.super = []
		self.exThrow = []
		self.superTicks = 0

		#net
		self.chatMessage = ""
		self.chatTimer = 0
		self.chatFont = pygame.font.Font("visitor1.ttf", 10)

		self.lastAnimation = self.currentAnimation
		
		#dash
		self.dashTimer = 0
		self.dashDirection = (0,0)
		
		#knockback
		self.knockbackVelocity = Vector2(0, 0)
		
		#over the line logic
		self.runningHome = False
		
		#midair throw bonus
		self.midairBonus = False
		
		#particle timer
		self.pTimer = 0

		self.localPlayer = False
		self.localPlayerAnimationName = "stand"
示例#45
0
 def __init__(self,
              content,
              window,
              x=0,
              y=0,
              fontFam="Arial",
              fontSize=24):
     Sprite.__init__(self, window, x, y)
     self.content = content
     self.fontFam = fontFam
     self.fontSize = fontSize
     self.color = WHITE
     self.font = font.SysFont(self.fontFam, self.fontSize)
     self.sprite = self.font.render(self.content, 1, self.color)
示例#46
0
 def __init__(self, level, pos, facing=0):
     Sprite.__init__(self, level, pos, facing)
     
     level.destructibles.add(self)
     
     self.tile = 0, 2
     self.facing = 2
     self.layer = 1
     self.speed = 250
     self.rotate = True
     
     self.move_key = None
     self.following = pygame.sprite.Group()
     self.pushing = pygame.sprite.Group()
     self.inv = pygame.sprite.Group()
示例#47
0
    def __init__(self,
                 x,
                 y,
                 w,
                 h,
                 vel_x=0,
                 vel_y=0,
                 vel=1,
                 cor=(200, 0, 150),
                 imagem=None):

        Entidade.__init__(self, x, y, w, h, vel_x, vel_y, vel)
        Sprite.__init__(self, imagem, cor)

        self.cor = cor
示例#48
0
 def __init__(self, game, map, target):
     Sprite.__init__(self)
     self._load_frames()
     self.type = type
     self.image = self.animation.get_image()
     self.rect = self.image.get_rect()
     self.map = map
     self.can_be_clicked = False
     self.rect.x = target.rect.x + (target.rect.w/2 - self.rect.w/2)
     self.rect.y = target.rect.y - target.rect.h/2
     self.z = -10
     self.game = game
     self._load_frames()
     map.sprites.add(self)
     self.target = target
 def __init__(self, game, map, target):
     Sprite.__init__(self)
     self._load_frames()
     self.type = type
     self.image = self.animation.get_image()
     self.rect = self.image.get_rect()
     self.map = map
     self.can_be_clicked = False
     self.rect.x = target.rect.x + (target.rect.w/2 - self.rect.w/2)
     self.rect.y = target.rect.y - target.rect.h/2
     self.z = -10
     self.game = game
     self._load_frames()
     map.sprites.add(self)
     self.target = target
示例#50
0
 def __init__(self, world, obj):
     if obj.gid is None:
         print >>sys.stderr, 'Coin: must be created from tile object'
         sys.exit(1)
     self.world = world
     self.gid = obj.gid
     tile = world.data.tiles[self.gid]
     self.count=0
     Sprite.__init__(self,
             world,
             obj.kind,
             '{} ({},{})'.format(obj.kind, obj.x, obj.y),
             tile.get_width(), tile.get_height(),
             obj.x, obj.y,
             (0.0, 0.0))
示例#51
0
 def __init__(self, world, obj):
     if obj.gid is None:
         print >> sys.stderr, 'Baddy: must be created from tile object'
         sys.exit(1)
     self.world = world
     self.gid = obj.gid
     tile = world.data.tiles[self.gid]
     Sprite.__init__(self, world, obj.kind,
                     '{} ({},{})'.format(obj.kind, obj.x,
                                         obj.y), tile.get_width(),
                     tile.get_height(), obj.x, obj.y, (16.0, 16.0))
     self.addForce('friction', (1.0, 0.0), 'slowdown')
     self.addForce('gravity', (0.0, 1.0), 'constant')
     self.walk = 0
     self.left = True
示例#52
0
    def __init__(self, *args):
        #calling default Sprite constructor
        Sprite.__init__(self, *args)
        self.__startrect = self.rect.copy()
        self.__maxvelocity = Vector2(config.PLAYER_MAX_SPEED, 100)
        self.__startspeed = 1.5

        self._velocity = Vector2()
        self._input = 0
        self._jumpforce = config.PLAYER_JUMPFORCE
        self._bonus_jumpforce = config.PLAYER_BONUS_JUMPFORCE

        self.gravity = config.GRAVITY
        self.accel = .5
        self.deccel = .6
        self.dead = False
示例#53
0
    def __init__(self, type, x, y):
        Sprite.__init__(self)

        if config.SHOW_PLACEHOLDERS:
            self.image = common.load('placeholder.png', True)
        else:
            self.image = common.load('hide.png', True)

        self.rect = self.image.get_rect()
        self.rect.topleft = (x, y)
        self.are_used = False
        self.is_floor = False

        self.rect.width = 75
        self.rect.height = 75
        self.type = type
示例#54
0
    def __init__(self, text=None, color=(0, 0, 0), initial_override=None):
        self.initial = {"translate": (0, 0), "scale": 0.1}

        Sprite.__init__(self, 'assets/sprites/button_case.png')

        if text is not None:
            self.rendered_text = Fonts().getFont("main").render(
                text, True, color)
            self.image.blit(self.rendered_text, self.calculateTextLocation())
            self.text = text

        if initial_override is not None:
            self.initial = initial_override
        else:
            self.initial = {"translate": (50, 50), "scale": 0.1}
        self.applyInitalActions()
示例#55
0
 def __init__(self, world, obj):
     self.world = world
     self.gid = obj.gid
     self.x = obj.x
     self.y = obj.y
     tile = world.data.tiles[self.gid]
     Sprite.__init__(self, world, obj.kind,
                     '{} ({},{})'.format(obj.kind, obj.x,
                                         obj.y), tile.get_width(),
                     tile.get_height(), obj.x, obj.y, (16.0, 16.0))
     self.addForce('friction', (1.0, 0.0), 'slowdown')
     self.addForce('gravity', (0.0, 1.0), 'constant')
     self.walk = 0
     self.left = False
     self.active = False
     self.burnSound = pygame.mixer.Sound('LOZ_Bomb_Blow.wav')
     self.fireSound = pygame.mixer.Sound('LOZ_Candle.wav')
     self.casting = 0
示例#56
0
    def __init__(self, team):
        Sprite.__init__(self)
        self.team = team
        self.number_human_player = 0
        self.image = 0  #current image
        self.skin_color = ()
        self.previous_pos = []

        #player characteristics
        self.pos_ref = []  #reference position in west half field
        self.pos_aim = [
        ]  #in full field coords, (scaled depending on ball position) (not used by GK)
        self.pos = []  #current position
        self.speed = 1
        self.health = 100
        self.max_energy = 1000  #before speed decreases
        self.resistance = 1  #before going KO
        self.control = 1  #before being hurt by ball
        self.kick = 1  #for shooting
        self.punch = 1  #for attacking
        self.jump_hight = 1
        #IA characteristics
        self.agressivity = 1
        self.precision = 1  #for GK and pass
        self.listening = 1  #wants to pass, and accepts to pass (max:2)

        self.inputs = 0  #class Inputs, constructor differs if Player_CPU or Player_Human
        self.anim_index = 0
        self.direction = 1  # +1: right, -1: left
        self.state = "walk"
        self.has_ball = 0  #the ball if is in "hands"
        self.dist2_to_ball = 0  #square of planar dist to ball

        self.jump_speed = 0
        self.energy = self.max_energy
        self.current_shoot_speed = [
            0, 0, 0
        ]  #where the ball will go when preshoot is finished

        self.anim = {}  #dictionnary for left and right

        self.is_saying = ""  #what the player is saying
        self.is_saying_timer = 0
    def __init__(self,
                 x,
                 y,
                 w,
                 h,
                 vel_x,
                 vel_y,
                 vel,
                 cor=(0, 25, 125),
                 imagem=None):

        Entidade.__init__(self, x, y, w, h, vel_x, vel_y, vel)
        Sprite.__init__(self, imagem, cor)

        self.__qnt_moedas = 0
        self.__vida = 3
        self.__gravidade = 5.8  #3.2
        self.__cor = cor
        self.__no_chao = False
示例#58
0
 def __init__(self, game, audio, messages, x, y, map):
     Sprite.__init__(self)
     self.game = game
     self.messages = messages
     self._load_frames()
     self.set_animation("stand")
     self.rect = self.image.get_rect()
     self.rect.move_ip((x - self.rect.w / 2, y - self.rect.h))
     #self.messages = messages
     #self.audio = audio
     #self.say(u"Hola, ¿como andas?")
     #self.change_state(Walk(self, 100, 100))
     self.change_state(Stand(self))
     self.map = map
     self.can_be_clicked = True
     self.flip = False
     self.has_a_pipe_in_hands = False
     self.z = -5
     self.audio = audio
     self.arrow = None 
示例#59
0
    def __init__(self,
                 x,
                 y,
                 w,
                 h,
                 vel_x,
                 vel_y,
                 vel,
                 cor=(0, 25, 125),
                 imagem=None):

        Entidade.__init__(self, x, y, w, h, vel_x, vel_y, vel)
        Sprite.__init__(self, imagem, cor)

        self.__vida = 1
        self.__gravidade = 5.8  #3.2
        self.__cor = cor
        self.__no_chao = False
        self.x_inicial = x
        self.y_inicial = y