Python Game Programming Tutorial: Space Invaders 4

preview_player
Показать описание
Time to kill some enemies - learn how to create the player's weapon in this video.

NEED HELP?

❤️❤️ SHOW SOME LOVE AND SUPPORT THE CHANNEL ❤️❤️

Click Join and Become a Channel Member Today!
Channel members can get preferential comment replies, early access to new content, members only live streams, and access to my private Discord.

Amazon Affiliate Links

Other Affiliate Links

LINKS

LEARN MORE PYTHON

LEARN MORE JAVA

#Python #Tutorial #Beginner
Рекомендации по теме
Комментарии
Автор

when you realize he spelled heading wrong before he realizes
so the student becomes the master

wyattcaldwell
Автор

I found out that the reason why the bullet gets stuck sometimes is because the flag bulletstate gets set to "fire" in the function "fire_bullet" however, even though it is set as a global variable, in the loop it remains with the "readdy" value, that's why it shows up but it doesn't move.
The way I fixed it was: instead of using a flag to track the state, the code checks if the bullet is visible using the method "isvisible()", so:

# this goes in the fire_bullet function
if not bullet.isvisible():
x = player.xcor()
y = player.ycor() + 10
bullet.setposition(x, y)
bullet.showturtle()

# this goes inside the loop
if bullet.isvisible():
y = bullet.ycor() + bulletspeed
bullet.sety(y)

phb
Автор

l realy seen less than 3 people who is realy know what he teachs and how to teach in a clean and confort way, Christian you are in that 3, thanx

AkinJanet
Автор

Hello @TokyoEdTech, i'm obviously on episode 4 and just wanted to give some feedback. A month ago I bought a book for Python because I've always wanted to know how programming actually works. I'm about halfway through the book and thought to myself: It's a shame that the book doesn't develop a game. So I looked on YOutube and found your great series of videos. I find them super entertaining and instructive, thank you very much. ^^

jestry
Автор

Omg it finnaly works the bullet doesn't reset anymore yay. I didn't have the player cor in the if statement It was outside of it. I was looking for so many ways to try and fix it but pressing space a few times done the job.

janminator
Автор

This tutorial is one of the best I have found that help when trying to learn turtle as it is all explained <3.


Only problem I had is one of my 'ycor' lines had an 'x' instead of a 'y' and it took me about 40 mins to find it :3 :'(

Jack-xnoh
Автор

I like the fact you try your best to reply to every comment

sedwars
Автор

After I saw this video I started coding so thanks so much for that! Keep up the good work!

imperial_gunner_
Автор

A lot of comments associated with syntax errors. If, you at the beginner level try use any modern IDE like:
etc.


Be attention to syntax highlight.


P.S. - Author did great job, with simple coding and step by step explanation

bbz
Автор

i've never seen a tutorial like this
plz keep it on

mahendrank
Автор

Awesome tutorial for python beginners, highly recommend!

dispatchOS
Автор

You make really good videos. Thank you for teaching

bearz_ftw
Автор

Hi thank you very much for the video! Im just wondering how do I limit the ammo of the weapon?

raves_r
Автор

I've made it this far!! My biggest problem being typos. I think I need a better IDE. Great tutorial once again. Thanks.

teacherinthailan
Автор

When I fire the bullet:
1) enemy goes slower
2) once in 2 times it's stuck on top of the player (it happens on your video as well)
Can't solve it
Can you help, please?

I'm enjoying your tutorials btw. Thank you!

WhaleInTheSkies
Автор

Everything is fine, i'm so happy to see what i have to do next to make this game rock .Thx btw

ItsMeDante
Автор

Love your vids I love trying to figure out coding

KevHeero
Автор

Hey, so I just finished the video and the bullet just doesn't spawn, is there a fix for this? here are my codes for it -
#Create the player bullet
bullet = turtle.Turtle()
bullet.color("white")
bullet.shape("circle")
bullet.penup()
bullet.speed(0)
bullet.setheading(90)
bullet.shapesize(0.5, 0.5)
bullet.hideturtle()

bulletspeed = 20

#Define bullet state
#Ready- ready to fire
#Fire - bullet is firing
bulletstate = "ready"

and-
def fire_bullet():
#Declare bulletstate as a global if it needs changed
global bulletstate

#Move the bullet to just above the player
x = player.xcor()
y = player.ycor()
bullet.setposition(x, y + 10)
bullet.showturtle()




#create keyboard bindings
turtle.listen()
turtle.onkey(move_left, "Left")
turtle.onkey(move_right, "Right")
turtle.onkey(fire_bullet, "space")

and -

#Move the bullet
y = bullet.ycor()
y += bulletspeed
bullet.sety(y)

plz help . Also, nothing has changed, i just watched the collision video, and nothing is changing, I changed the enemy position and yet nothing has happened. Even if I change enemy speed, it still stays the same and nothing is customized/ So pretty much from part 4, nothing has happened to my project.

Shyam_NZ
Автор

Hi, I've been a python programmer for a while, but so far did only write console applications. I was very happy to discover that there's an easy way to draw to the screen in python. Your tutorials are great! But I really don't want to use globals. Isn't there a way to make the fire_bullet function return the bulletstate somehow?

clarencesmith
Автор

7:05 never mind just a reminder where i am in the video :)

RotieGaming
visit shbcf.ru