FTLinuxCourse - Tin tổng hợp mới nhất không thể bỏ lỡ
  • Home
  • Lập Trình Linux
  • Công Nghệ
  • Máy Tính
No Result
View All Result
  • Home
  • Lập Trình Linux
  • Công Nghệ
  • Máy Tính
No Result
View All Result
FTLinuxCourse - Tin tổng hợp mới nhất không thể bỏ lỡ
No Result
View All Result

Pygame Tutorial – 8 – Creating the Enemy – Space Invader

admin by admin
February 8, 2020
in Lập Trình Linux
4
Pygame Tutorial – 8 – Creating the Enemy –  Space Invader



In this we will video we will create an enemy for our lonely spaceship. In this process learning about re-spawning and randomization of location of the enemy

Next video – Movement of the Enemy

Full playlist –

Subscribe –
Website – www.buildwithpython.com
Instagram –

#python #pygame

Nguồn:https://ftlinuxcourse.com/

Xem Thêm Bài Viết Khác:https://ftlinuxcourse.com/lap-trinh-linux

Tags: Youtube
Previous Post

Cài Pascal trên Linux (Cách khác)

Next Post

Hướng dẫn cài jx linux trên vps full không che

Next Post
Hướng dẫn cài jx linux trên vps full không che

Hướng dẫn cài jx linux trên vps full không che

Comments 4

  1. Thelavendel says:
    2 years ago

    I just realized that following a project step by step like this, is my preferred method for learning programming! Don't have the patience for long books. Thanks a lot!

    Reply
  2. Hayaya says:
    2 years ago

    this sir deserves lots of subs

    Reply
  3. Vinay M says:
    2 years ago

    You made the tutorial very easy to understand and interesting.

    Reply
  4. nickolas rizzato says:
    2 years ago

    can someone point out the mistakes in my code?

    import pygame

    # intialize the pygame
    pygame.init()

    # create the screen
    screen = pygame.display.set_mode((800, 600))

    # Title and Icon
    pygame.display.set_caption('Space Invaders')

    icon = pygame.image.load('ufo.png')
    pygame.display.set_icon(icon)

    # Player
    playerImg = pygame.image.load('spaceShip.png')
    playerX = 30
    playerY = 480
    playerX_change = 0

    def player(x,y):
    screen.blit(playerImg, (x,y))

    # Game Loop
    running = True
    while running:
    screen.fill((0,0,0))

    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    running = False

    # if keystroke is pressed check whether its right or left
    if event.type == pygame.KEYDOWN:
    if event.key == pygame.K_LEFT:
    playerX_change = -0.7

    if event.type == pygame.K_RIGHT:
    playerX_change = 0.7

    if event.type == pygame.KEYUP:
    if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
    playerX_change = 0

    playerX += playerX_change

    if playerX <= 0:
    playerX = 0
    elif playerX >= 736:
    playerX = 736

    player(playerX, playerY)
    pygame.display.update()

    pygame.quit()

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Xem Thêm

Những điều bạn có thể chưa biết về Thánh sim Hi Vietnamobile

Những điều bạn có thể chưa biết về Thánh sim Hi Vietnamobile

January 17, 2021
Xiaomi Mi 10 Pro thiết kế thời thương, màn hình cong ấn tượng

Xiaomi Mi 10 Pro thiết kế thời thương, màn hình cong ấn tượng

June 1, 2021
Địa chỉ in bao bì nhựa tại Đà Nẵng chiết khấu cao

Địa chỉ in bao bì nhựa tại Đà Nẵng chiết khấu cao

January 26, 2021
Địa chỉ bán đèn tuýp LED Philips uy tín và chất lượng trên thị trường?

Bán đèn tuýp led Philips – Skyled

July 27, 2020
Lựa chọn chủ đề in áo thun phù hợp

Lựa chọn dịch vụ in áo thun cotton cần lưu ý gì?

August 2, 2020
Cần xác định được điểm đặt pallet cao nhất để mua xe

Bí quyết chọn mua xe nâng điện đẩy tay

August 3, 2020

Về Chúng Tôi

Báo ftlinuxcourse.com 24h – Đón xem những tin tức mới nhất về tình hình chính trị, xã hội, an ninh trật tự, văn hóa – giải trí, thể thao, thông tin trong ngày.

  • Liên Hệ
  • Chính Sách Bảo Mật

© 2022 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Lập Trình Linux
  • Công Nghệ
  • Máy Tính

© 2022 JNews - Premium WordPress news & magazine theme by Jegtheme.