Example #1
0
 def __init__(self, centerPoint, image):
     person.__init__(self , centerPoint, image) 
     self.life = 3
     self.alive = True
     self.coins = 0
     self.dx = 0
     self.dy = 0
     self.climb = 0#decides if player will climb ladder or not
     self.jump = 0#decides if player will jump or not
     self.jumpd = -1#decides whether to move up down/up
     self.jumpl = 0#saves jump length
     self.yspeed = PLAYERSPEED
     self.xspeed = PLAYERSPEED
     self.jump_sound = soundloader("jump.ogg")
Example #2
0
	def __init__(self , width , height ,level , life ,coins):
            pygame.init()#initialises pygame
            self.height = height	
            self.width = width
            self.screen = pygame.display.set_mode((self.width,self.height))#sets up display for pygame
            self.clock = pygame.time.Clock()#Initialize pygame clock which is used to control frames per second and bunch of different time realted things
            self.firelist = []#Contain all the sprites of fire
            self.running = 1 #loop running variable
            self.__level = level # private variable and sets it to current level 
            self.score = 0 #score of player
            self.theme_music = musicloader("main_theme.ogg")#loads in the music  from musicloader class of "loader.py"
            self.coin_sound = soundloader("coin.ogg")#loads in the coin taking sound from soundloader class of "loader.py"
            #difference between music and sound is that music is like game song and sound is like sound effects , only one music can be loaded and 
            #hence played at a time and at max eight sounds can be played together 
            self.theme_music.play()#playes in the music
            self.play(life , coins)#calls play function
            if self.__level <=2 and self.player.life:#if life is > 0 and level is less or equal to 2
                start(self.__level , self.player.life , self.player.coins)
            self.theme_music.stop()#stops the music
            end(self.score , self)#calls in end function from "end.py"