예제 #1
0
        computer=Computer(screen,width/2 ,height/2 ,100,(230,200,0))
        joon2-=1
        if joon2==0:
            pygame.mixer.music.stop()
            running2 = False
            print "computer is game over"
            screen.blit(text_wWin,(200,285))
            


#*****************************************************************#
#Food :                                
#*****************************************************************#
#dar in ghesmat barkhord be foodha chek mishavad dar sorat barkhord be food1 score 1 vahed va food2 score 3 vahed ziyad mishavad  .
        
    elif food.check(worm.x,worm.y):
        score1 += 1
        if score1 >=30:
            pygame.mixer.music.stop()
            running2 = False
            running1 = False
            print 'worm is winner'
            screen.blit(text_wWin,(200,285))
        worm.eat()
        print "Score1: %d" % score1
        food.erase()
        food=Food(random.randint(50, width-50), random.randint(50, height-50),(158,0,0),screen,7)

    elif food.check(computer.x,computer.y):
        score2 += 1
        if score2 >=30:
예제 #2
0
        screen.fill(bgcolor)
        snake = Snake(screen,(width/3)+50 ,height/2 ,100,(255,255,255))
        joon1-=1
        if joon1==0:
            pygame.mixer.music.stop()
            running1 = False
            print "worm is winner"
            screen.blit(text_wWin,(200,285))

#*****************************************************************#
#Food :                                 
#*****************************************************************#  
#dar in ghesmat barkhord be foodha chek mishavad dar sorat barkhord be food1 score 1 vahed va food2 score 3 vahed ziyad mishavad  .        
 
        
    elif food.check(worm.x,worm.y):
        score2 += 1
        if score2 >=30:
            pygame.mixer.music.stop()
            running2 = False
            running1 = False
            print 'worm is winner'
            screen.blit(text_wWin,(200,285))
        worm.eat()
        print "Score2: %d" % score2
        food.erase()
        food=Food(random.randint(50, width-50), random.randint(50, height-50),(158,0,0),screen,7)

    elif food.check(snake.x,snake.y):
        score1 += 1
        if score1 >=30: