Пример #1
0
 def init_image(self):
     self.top_left = img_manager.load_image("data/sprites/ground/GroundTopCornerLeft.png")
     self.top_right = img_manager.load_image("data/sprites/ground/GroundTopCornerRight.png")
     self.top = img_manager.load_image("data/sprites/ground/GroundTop.png")
     self.left = img_manager.load_image("data/sprites/ground/GroundSideLeft.png")
     self.right = img_manager.load_image("data/sprites/ground/GroundSideRight.png")
     self.ground = img_manager.load_image("data/sprites/ground/GroundFill.png")
     self.bottom_left = img_manager.load_image("data/sprites/ground/GroundBottomCornerLeft.png")
     self.bottom_right = img_manager.load_image("data/sprites/ground/GroundBottomCornerRight.png")
     self.bottom = img_manager.load_image("data/sprites/ground/GroundBottom.png")
Пример #2
0
 def __init__(self,object):
     Animation.__init__(self,object)
     self.obj = object
     self.img = img_manager.load_image("data/sprites/bullet/CatBullet.png")
     self.nmb = 0
     if isinstance(level_manager.level, GameState):
         self.player = level_manager.level.player
Пример #3
0
    def __init__(self,object):
        Animation.__init__(self,object)
        self.invincibility = 0
        self.obj = object
        self.img = None
        self.dialog = False
        self.nmb = 0
        self.in_area_left = False
        self.in_area_right = False
        self.boss_img = img_manager.load_image("data/sprites/boss/Bosscat.png")
        self.boss_delta = Vector2(60,10)
        self.animation_delta = Vector2()
        self.life = 10
        if isinstance(level_manager.level, GameState):
            self.player = level_manager.level.player

        self.boss_fight = False

        self.state = 'idle'
        self.direction = 0

        self.explosion = Animation(None)
        self.explosion.root_path = "data/sprites/"
        self.explosion.path_list = ["explosion/"]
        self.explosion.state_range = { "boum": [0,8]}
        self.explosion.load_images(Vector2(36,36))
        self.explosion_sound = snd_manager.load_sound("data/sound/Explosion.wav")
        self.boum = False
Пример #4
0
 def init_image(self, size=None):
     if self.anim:
         self.anim.load_images(size, self.tmp)
     else:
         self.img = img_manager.load_image(self.path, self.tmp)
         if self.size is None:
             self.size = Vector2(img_manager.get_size(self.img))
         self.rect = Rect(self.pos, self.size)
Пример #5
0
    def __init__(self,player):
        Animation.__init__(self, player)
        self.foot = 0
        self.player = self.obj
        self.speed = 3
        self.life = 3
        self.gravity = 30.0/60
        self.direction = True #True for right
        self.jump_step = CONST.jump_step
        self.wall = 0 #None=0, Left=1, Right=2
        self.wall_speed = 2.5
        self.wall_jump_step = 0
        self.not_sliding_wall = 0

        self.touched = False
        self.cat_touched = False

        self.invincibility = 0
        self.show_frequency = 10
        self.dialog = 0
        self.attacking = 0
        self.attack_time = 4*7

        self.transition = 1.0

        self.jump_sound = snd_manager.load_sound("data/sound/Jump2.wav")
        self.deal_with_it = img_manager.load_image("data/sprites/dealwithit.png")
        self.heart = img_manager.load_image("data/sprites/heart.png")
        self.deal_pos = Vector2(23,-7)
        self.deal_delta = Vector2(0,-160)
        self.move_deal = False

        self.slash = Animation(None)
        self.slash.root_path = "data/sprites/"
        self.slash.path_list = ["slash/"]
        self.slash.state_range = { "slash": [0,5]}
        self.slash.load_images()
Пример #6
0
    def init(self):
        snd_manager.set_playlist(['data/music/menu_gbjam.ogg'])
        self.img = img_manager.load_image("data/sprites/text/Title.png")
        self.font = sfml.Font.from_file("data/font/SILKWONDER.ttf")
        self.text = sfml.Text("PRESS START", self.font, 10)
        self.text.position = (58,63)
        self.text.color = sfml.Color.BLACK
        self.screen_pos = Vector2()
        self.time = 0
        self.dialog = False

        self.cat = Image(Vector2(),path="data/sprites/text/CatPortrait.png",size=Vector2(79,74))
        self.cat.init_image(size=Vector2(79,74))
        self.cat.pos = engine.screen_size-self.cat.size
        self.ferret = Image(Vector2(),path="data/sprites/text/FerretPortrait.png",size=Vector2(73,74))
        self.ferret.init_image(size=Vector2(73,74))

        self.ferret.pos = Vector2(0,engine.screen_size.y)-Vector2(0,self.cat.size.y)
Пример #7
0
 def load_images(self,size=None,tmp = False):
     self.img_indexes = []
     
     for p in self.path_list:
         
         path = CONST.path_prefix+self.root_path+p
         files = []
         if ".png" in path:
             files = [path]
         else:
             files = [ os.path.join(path, f) for f in listdir(path) if (isfile(join(path, f)) and f.find(".png") != -1) ]
         files.sort()
         for f in files:
             self.img_indexes.append(img_manager.load_image(f,tmp))
         try:
             self.img = self.img_indexes[0]
         except IndexError:
             pass
     if size is None:
         self.size = img_manager.get_size(self.img)
     else:
         self.size = Vector2(size)
     if self.obj:
         self.obj.update_rect()
Пример #8
0
 def init_image(self):
     self.base = img_manager.load_image("data/sprites/stump/StumpBase.png")
     self.top = img_manager.load_image("data/sprites/stump/StumpTop.png")
     self.fill = img_manager.load_image("data/sprites/stump/StumpFill.png")
Пример #9
0
 def init_image(self):
     self.img = img_manager.load_image("data/sprites/foreground/LongGrass.png")
Пример #10
0
 def init_image(self):
     self.right = img_manager.load_image("data/sprites/trunk/TrunkSideRight.png")
     self.left = img_manager.load_image("data/sprites/trunk/TrunkSideLeft.png")
     self.fill = img_manager.load_image("data/sprites/trunk/TrunkFill.png")