def fire(self,a,f,coins,player_life,score,last_element,player_pos_i,player_pos_j,remedy) : p=Printer() i=0 value=0 while(i<16): ############# MAIN LOOP THAT CONTROLS FIREBALLS ################## if f[i]=='X': break if f[i]<4 and f[i+1]<3 : f[i]=f[i]+1 f[i+1]+=1 i = i+2 continue if f[i]==4 and f[i+1]==3: a[f[i]][f[i+1]]='O' ################ moving fireballs forward ############################### if a[f[i]+1][f[i+1]+1]=='X' or a[f[i]+1][f[i+1]-1]=='X' : value=self.check_collision(a,f,player_pos_i,player_pos_j,player_life,score,remedy) if value==1 : return a[f[i]][f[i+1]]=Fireball.last_pos[i/2] if Fireball.last_pos[i/2]=='P':## to remove P after collision a[f[i]][f[i+1]]=last_element ## f[i+1]=f[i+1]+Fireball.lor[i/2] Fireball.last_pos[i/2]=a[f[i]][f[i+1]] ###MARK ######## if Fireball.last_pos[i/2]=='O': Fireball.last_pos[i/2]=0 a[f[i]][f[i+1]]='O' if a[f[i]][f[i+1]+1]=='X' : ################## collision with wall Fireball.lor[i/2]=-1 if a[f[i]][f[i+1]-1]=='X' : ################### collision with wall Fireball.lor[i/2]=1 if a[f[i]+1][f[i+1]+1]=='H' and randint(0,2) : ########################### fall from stairs a[f[i]+1][f[i+1]+1]='O' a[f[i]][f[i+1]]=Fireball.last_pos[i/2] Fireball.last_pos[i/2]='H' p.printer(a,coins,player_life,score) time.sleep(0.05) a[f[i]+5][f[i+1]+1]='O' a[f[i]+1][f[i+1]+1]='H' f[i]=f[i]+5 f[i+1]=f[i+1]+1 if randint(1,9)>=4: Fireball.lor[i/2]=1 else : Fireball.lor[i/2]=-1 if a[f[i]+1][f[i+1]+1]==0: ############################### fall from empty structure a[f[i]+1][f[i+1]+1]='O' a[f[i]][f[i+1]]=Fireball.last_pos[i/2] Fireball.last_pos[i/2]=0 p.printer(a,coins,player_life,score) time.sleep(0.05) a[f[i]+5][f[i+1]+1]='O' a[f[i]+1][f[i+1]+1]=0 f[i]=f[i]+5 f[i+1]=f[i+1]+1 if randint(1,9)>=4: Fireball.lor[i/2]=1 else : Fireball.lor[i/2]=-1 i=i+2 p.printer(a,coins,player_life,score) time.sleep(0.1)
def jumper(self,a,z,player_pos,coins,player_life,score,last_element,f): p = Printer() pre=0 i=player_pos[0] j=player_pos[1] a[i][j]=last_element p.printer(a,coins,player_life,score) ########### JUMP IS ANIMATED USING APPROPRIATE DELAYS ############### time.sleep(0.09) pre=a[i-2][j] a[i-2][j]='P' p.printer(a,coins,player_life,score) time.sleep(0.07) a[i-2][j]=pre p.printer(a,coins,player_life,score) time.sleep(0.09) pre=a[i-2][j+z] a[i-2][j+z]='P' p.printer(a,coins,player_life,score) time.sleep(0.07) a[i-2][j+z]=pre p.printer(a,coins,player_life,score) time.sleep(0.09) pre=a[i][j+z] a[i][j+z]='P' p.printer(a,coins,player_life,score) player_pos[1]=j+z return pre