コード例 #1
0
ファイル: Worm.py プロジェクト: kallepersson/subterranean-ng
 def __init__(self,game):
     Character.__init__(self)
     self.Game = game
     self.setName("worm")
     self.setTitle('Mask')
     self.setImage('worm.png')
     self.setPosition((434,446))
     self.setTextColor((255,128,0))
     
     self.addTopic('whatsup','Hur är läget?',self.talkWhatsUp)        
     self.addTopic('sky','Vilken himmel vi har!',self.talkSky)
     
     self.addGiveMethod(self.giveChiliToWorm,'chili')
     self.addGiveMethod(self.givePotionToWorm,'potion')
     self.addGiveMethod(self.giveFirepotionToWorm,'firepotion')
     
     self.setUseMethod(self.wormUse)
     self.setLookMethod(self.wormLook)
     self.setTalkMethod(self.wormTalk)
     self.setPickupMethod(self.wormPickup)
コード例 #2
0
    def __init__(self,game):
        Character.__init__(self)

        self.leftFoot = False
                
        self.Game = game
        self.originalRect = None
        self.rect = None
        self.visible = False
        self.frameKey = 0
        self.startFrame = None
        self.startMillis = 0
        self.frameDuration = 3
        self.callbackMethod = None
        self.callbackArgument = None
        self.rect = pygame.Rect(0,0,129,20)
        self.direction = 's'
        
        self.walkFrameCount = 0
        
        #Stand
        self.addSequence('ns',[
            self.Game.get('PLAYER_STAND_N_1')
        ])
        self.addSequence('es',[
            self.Game.get('PLAYER_STAND_E_1')
        ])
        self.addSequence('ss',[
            self.Game.get('PLAYER_STAND_S_1')
        ])
        self.addSequence('ws',[
            self.Game.get('PLAYER_STAND_W_1')
        ])
        self.addSequence('nes',[
            self.Game.get('PLAYER_STAND_NE_1',)
        ])
        self.addSequence('ses',[
            self.Game.get('PLAYER_STAND_SE_1')
        ])
        self.addSequence('sws',[
            self.Game.get('PLAYER_STAND_SW_1')
        ])
        self.addSequence('nws',[
            self.Game.get('PLAYER_STAND_NW_1')
        ])
        
        #Walk
        self.addSequence('nw',[
            (self.Game.get('PLAYER_WALK_N_1'),3),
            (self.Game.get('PLAYER_WALK_N_2'),3),
            (self.Game.get('PLAYER_WALK_N_3'),3),
            (self.Game.get('PLAYER_WALK_N_4'),3),
            (self.Game.get('PLAYER_WALK_N_5'),3),
            (self.Game.get('PLAYER_WALK_N_6'),3),
            (self.Game.get('PLAYER_WALK_N_7'),3),
            (self.Game.get('PLAYER_WALK_N_8'),3),
        ])
        self.addSequence('sw',[
            (self.Game.get('PLAYER_WALK_S_1'),3),
            (self.Game.get('PLAYER_WALK_S_2'),3),
            (self.Game.get('PLAYER_WALK_S_3'),3),
            (self.Game.get('PLAYER_WALK_S_4'),3),
            (self.Game.get('PLAYER_WALK_S_5'),3),
            (self.Game.get('PLAYER_WALK_S_6'),3),
            (self.Game.get('PLAYER_WALK_S_7'),3),
            (self.Game.get('PLAYER_WALK_S_8'),3),
        ])
        self.addSequence('ew',[
            (self.Game.get('PLAYER_WALK_E_1'),3),
            (self.Game.get('PLAYER_WALK_E_2'),3),
            (self.Game.get('PLAYER_WALK_E_3'),3),
            (self.Game.get('PLAYER_WALK_E_4'),3),
            (self.Game.get('PLAYER_WALK_E_5'),3),
            (self.Game.get('PLAYER_WALK_E_6'),3),
            (self.Game.get('PLAYER_WALK_E_7'),3),
            (self.Game.get('PLAYER_WALK_E_8'),3),
        ])
        self.addSequence('ww',[
            (self.Game.get('PLAYER_WALK_W_1'),3),
            (self.Game.get('PLAYER_WALK_W_2'),3),
            (self.Game.get('PLAYER_WALK_W_3'),3),
            (self.Game.get('PLAYER_WALK_W_4'),3),
            (self.Game.get('PLAYER_WALK_W_5'),3),
            (self.Game.get('PLAYER_WALK_W_6'),3),
            (self.Game.get('PLAYER_WALK_W_7'),3),
            (self.Game.get('PLAYER_WALK_W_8'),3),
        ])
        self.addSequence('new',[
            (self.Game.get('PLAYER_WALK_NE_1'),3),
            (self.Game.get('PLAYER_WALK_NE_2'),3),
            (self.Game.get('PLAYER_WALK_NE_3'),3),
            (self.Game.get('PLAYER_WALK_NE_4'),3),
            (self.Game.get('PLAYER_WALK_NE_5'),3),
            (self.Game.get('PLAYER_WALK_NE_6'),3),
            (self.Game.get('PLAYER_WALK_NE_7'),3),
            (self.Game.get('PLAYER_WALK_NE_8'),3),
        ])
        self.addSequence('sew',[
            (self.Game.get('PLAYER_WALK_SE_1'),3),
            (self.Game.get('PLAYER_WALK_SE_2'),3),
            (self.Game.get('PLAYER_WALK_SE_3'),3),
            (self.Game.get('PLAYER_WALK_SE_4'),3),
            (self.Game.get('PLAYER_WALK_SE_5'),3),
            (self.Game.get('PLAYER_WALK_SE_6'),3),
            (self.Game.get('PLAYER_WALK_SE_7'),3),
            (self.Game.get('PLAYER_WALK_SE_8'),3),
        ])
        self.addSequence('sww',[
            (self.Game.get('PLAYER_WALK_SW_1'),3),
            (self.Game.get('PLAYER_WALK_SW_2'),3),
            (self.Game.get('PLAYER_WALK_SW_3'),3),
            (self.Game.get('PLAYER_WALK_SW_4'),3),
            (self.Game.get('PLAYER_WALK_SW_5'),3),
            (self.Game.get('PLAYER_WALK_SW_6'),3),
            (self.Game.get('PLAYER_WALK_SW_7'),3),
            (self.Game.get('PLAYER_WALK_SW_8'),3),
        ])
        self.addSequence('nww',[
            (self.Game.get('PLAYER_WALK_NW_1'),3),
            (self.Game.get('PLAYER_WALK_NW_2'),3),
            (self.Game.get('PLAYER_WALK_NW_3'),3),
            (self.Game.get('PLAYER_WALK_NW_4'),3),
            (self.Game.get('PLAYER_WALK_NW_5'),3),
            (self.Game.get('PLAYER_WALK_NW_6'),3),
            (self.Game.get('PLAYER_WALK_NW_7'),3),
            (self.Game.get('PLAYER_WALK_NW_8'),3),
        ])
        
        self.pos = (0,0)
        self.scale = 1
        self.walking = False
        self.talking = False
        self.standardResponses = {
            'PICKUP':"I can't pick that up",
            'USE':"Um... no.",
            'TALK':"I might as well be talking to myself.",
            'LOOK':"There is nothing noteworthy about it.",
            'GIVE':"I'm not giving that away."
        }
        
        self.textColor = (145,191,232)
        self.name = 'Player'
        self.path = []