موضوعات وبسایت : برنامه نویسی
سوالات امتحان آیین نامه رانندگی

سورس بازی با پایتون

سورس بازی با پایتون

نویسنده : مینا علی زاده | زمان انتشار : 06 فروردین 1401 ساعت 11:05

جهت انجام پروژه های دانشجویی و یا تمرین‌های برنامه نویسی رشته کامپیوتر میتوانید به آی دی تلگرام زیر پیام دهید

@AlirezaSepand



در این بخش دانلود سورس بازی Snake با پایتون را برای شما عزیزان آماده دانلود کرده ایم. جهت دانلود سورس بازی می توانید بر روی لینک دانلود محصول کلیک کنید.

سوالات امتحان آیین نامه رانندگی

درباره سورس کد :

رمز عبور فایل فشرده www.copro.ir می باشد.

بخشی از سورس بازی Snake با پایتون Python:

def creator():
    canvas.fill(BLACK)
    my_img = pygame.image.load('image1.jpg')
    my_img_rect = my_img.get_rect()
    my_img_rect.center = (WINDOW_WIDTH/2, my_img_rect.height/2 + 20)
    canvas.blit(my_img, my_img_rect)

    start_inst1 = large_font.render("Surya Prakash Reddy", False, GREEN)
    start_inst1_rect = start_inst1.get_rect()
    start_inst1_rect.center = (WINDOW_WIDTH/2, 420)
    canvas.blit(start_inst1, start_inst1_rect)

    start_inst2 = small_font.render("Hello guys, This is Surya. Thanks for playing my game.", True, BLUE)
    start_inst3 = small_font.render("This is a very simple game, developed using python", True, BLUE)
    start_inst4 = small_font.render("In case of queries, write to surajchinna1@gmail.com", True, BLUE)
    canvas.blit(start_inst2, (10, 470))
    canvas.blit(start_inst3, (10, 500))
    canvas.blit(start_inst4, (10, 530))

    start_inst5 = medium_font.render("<<BACK", True, RED, YELLOW)
    start_inst5_rect = start_inst5.get_rect()
    start_inst5_rect.center = (WINDOW_WIDTH - start_inst5_rect.width/2, WINDOW_HEIGHT - start_inst5_rect.height/2)
    canvas.blit(start_inst5, start_inst5_rect)
    pygame.display.update()

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if event.type == pygame.MOUSEBUTTONDOWN:
                x, y = event.pos
                if x > start_inst5_rect.left and x < start_inst5_rect.right:
                    if y > start_inst5_rect.top and y < start_inst5_rect.bottom:
                        start_game()
        pygame.display.update()

آیا این مطلب برای شما مفید بود؟


منبع: copro.ir



ارسال نظر

نام


ایمیل


نظر