Комментарии:
bullet wont stay with the ship. fires from left side of screen only. how to fix?
ОтветитьWhenever i am trying to run the program the screen of pygame doesn’t work
Is there any solution for me?
using flaticon u have to use 500 px just download it then open where its saved then change its size
Ответитьloved the video
Ответитьexcellent
Ответитьcan print our score on the game window
ОтветитьWow Finally I successfully completed coding , implemented and played the game. Thanks a lot
ОтветитьIm indian and I think this man has destroyed everyone's expectations of our english
ОтветитьHernandez Maria Hall Sarah Gonzalez Brian
ОтветитьWayyy better
Ответитьcode is correct but spaceShip is not moving
Ответитьcan someone please tlel me how to get the autofill thing cuz they don't come up for me
ОтветитьI watched it one sitting
ОтветитьYou come up with the idea of a game, teaching everything one needs to accomplish it. Much better than any book or tutorial I ever read!
ОтветитьFor some reason my bullet isnt appearing on the screen.
import pygame
import random
pygame.init()
running = True
# Screen
screen = pygame.display.set_mode((1200, 800))
image = pygame.image.load('rocket.png')
pygame.display.set_icon(image)
# Background
background = pygame.image.load('background.jpg')
# player
player_image = pygame.image.load('spaceship.png')
playerX = 550
playerY = 650
playerchange = 50
# Enemy
enemy_image = pygame.image.load('enemies.png')
enemyX = random.randint(0, 1200)
enemyY = random.randint(50, 150)
enemychangeX = 0.3
enemychangeY = 30
# Bullet
bullet_image = pygame.image.load('bullet.png')
bulletX = 0
bulletY = 650
bullet_state = False
bulletchangeY = 10
# Drawing spaceship on the surface
def player(x, y):
screen.blit(player_image, (x, y))
def enemy(x, y):
screen.blit(enemy_image, (x, y))
def bullet_fire(x, y):
global bullet_state
bullet_state = True
screen.blit(bullet_image, (x + 16, y + 10))
# Game loop
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
playerX = playerX - playerchange
if event.key == pygame.K_RIGHT:
playerX = playerX + playerchange
if event.key == pygame.K_SPACE:
bullet_fire(playerX, bulletY)
if event.type == pygame.KEYUP:
if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
playerX = playerX
if playerX <= 0:
playerX = 0
if playerX >= 1072:
playerX = 1072
enemyX += enemychangeX
if enemyX <= 0:
enemychangeX = 0.3
enemyY += enemychangeY
elif enemyX >= 1072:
enemychangeX = -0.3
enemyY += enemychangeY
if bullet_state is True:
bullet_fire(playerX, bulletY)
bulletY -= bulletchangeY
screen.fill((0, 0, 0))
screen.blit(background, (0, 0))
player(playerX, playerY)
enemy(enemyX, enemyY)
pygame.display.update()
(Can anyone tell me whats the problem)
This tutorial helped me in preparation of using Unreal engine and studying software engineering at university level
ОтветитьFor some reason it wont let me insert a image
ОтветитьAnyone from 8std
ОтветитьShowing many errors don't know why
ОтветитьHow to add the downloaded png to your poroject
Ответитьthis is fucking terrible
Ответитьbest tutorial about pygame❤🔥
ОтветитьPNG file image is not loading in mine, the image does not get loaded, when I try to run the code, it shows "Unsupported Image Format" !! What should I do ??
ОтветитьMy player and enemy are glitching
Ответитьjust finished this tutorial - it's great. Many thanks for making this and making it easy to follow.
ОтветитьThis tutorial is nothing short of amazing, I am working on a school project and using this video, I was taught how to use something I was considered a complex topic, so efficiently. Big thanks to you guys at freeCodeCamp. Cheers!
Ответитьi love this guy
Ответитьthis video is good
ОтветитьEveryone who just got learned properly because of this man and i learned this in just some minutes people who think that this man should get the best teacher award (Like)
ОтветитьI've been searching for how to add the PNG images to the Pycharm Directory, or in other words, the sidebar list. That was skipped in the tutorial -- the file was already there when that chapter started.
I have the image I'd like to use for my player icon (spaceship). Any advice on how this is properly done?
I'm using a Mac.
How to atually add photos in vs code
as png files
amazing
ОтветитьReally is wonderful journey for gaming
ОтветитьSzkoda tylko że nie ma mechaniki FPS, a to podstawa nawet w najprostszych grach w pygame.
Ответитьsome how I have to press alt and spacebar at the same time in order to shoot the bullet. strange..... :V
ОтветитьHey screen fill is not working
ОтветитьGood course but you have a bad habit of using too much comments
ОтветитьTremendous, thanks for the tutorial!
ОтветитьYou should make something like this for teachers to teach certain chunks of knowledge and then the person can play if they get the answers right. Work, then play, then work, then play
ОтветитьFreecodecamp, please try to post a video on the tutorial ursina python 3d game engine.
Ответить<3
ОтветитьEs una gran introducción a PyGame.
¡Felicitaciones!
It is a great introduction to PyGame.
Congratulations!
Although I struggle for 3 days, but nice for beginners like me. Thank you so much! Hope u have the best when prodiving very detailed and free-acess education for people!
Ответить