示例#1
0
 def movedonkey(self,game):
         game.resetperson(self)
         if random.randint(1,2)==1:
                 self.moveleft()
                 if game.checkwall(self.getxcordinate(),self.getycordinate()):
                         self.moveright()
         else:
                 self.moveright()
                 if game.checkwall(self.getxcordinate()-1,self.getycordinate())==False:
                         self.moveleft()
         game.setcoins()
         game.setperson(self)
示例#2
0
        def moveright_player(self,game):
            game.resetperson(self)
            if game.checkwall(self.getxcordinate(),self.getycordinate()-1):
                pass
            else :
                self.moveright()
		game.setperson(self)
		self.checkair(game)
		game.resetperson(self)
            if game.checkcoins(self.getxcordinate(),self.getycordinate()):
                    game.coins[self.getxcordinate()][self.getycordinate()]=" "
                    self.score+=5
                    game.setcoins()
示例#3
0
        def jumpleft_player(self,donkey,fireballs,game,princess): # 4step 
		for i in range(1,3):
		        game.resetperson(self)
			if game.checkwall(self.getxcordinate()+1,self.getycordinate()+1):
				self.checkair(game)
				break	
		        self.setxcordinate(self.getxcordinate()+1)
		        self.setycordinate(self.getycordinate()+1)
		        game.update(donkey,fireballs,self,princess)
		        game.setperson(self)
		        game.printboard(self)
		        time.sleep(0.1)
                game.resetperson(self)
		if game.checkwall(self.getxcordinate()-1,self.getycordinate()+1):
			self.checkair(game)
			game.update(donkey,fireballs,self,princess)
			return 
                self.setxcordinate(self.getxcordinate()-1)
                self.setycordinate(self.getycordinate()+1)
                game.update(donkey,fireballs,self,princess)
                game.setperson(self)
                game.printboard(self)
                time.sleep(0.1)
                game.resetperson(self)
		if game.checkwall(self.getxcordinate()-1,self.getycordinate()-1):
			self.checkair(game)
			game.update(donkey,fireballs,self,princess)
			return
                self.setxcordinate(self.getxcordinate()-1)
                self.setycordinate(self.getycordinate()+1)
		self.checkair(game)
                game.update(donkey,fireballs,self,princess)
                game.setperson(self)