Python Game Programming Tutorial: SpaceWar 2

preview_player
Показать описание
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
Рекомендации по теме
Комментарии
Автор

Who else got the Space War and Space Invader tutorials mixed up? That really confused me.

johnnyhoran
Автор

To anyone who has the problem of self.speed isn't defined
the solution is very simple
under the player = sprite
write


playerspeed = 0.5


then in player.fd()
write playerspeed in it


player.fd(playerspeed)


this means that the player sprite is going foward equal to the player speed
so its basically saying
player.fd(0.5)

kanyewestfan
Автор

great content, keep up. Also, well done on replying everyone, good to see (Y)

javiporras
Автор

I watched a couple of videos and I’ve done some code of yours and I think I’ve picked up coding a little from you because I fixed the code by myself

eddanimoots
Автор

It says Player.turn_left() missing 1 required positional afrument: ”self”
turtle.onkey(Player.turn_left, ”Left”) is the line

jonipynnonen
Автор

adding a limit is a great idea

def faster(self):
self.speed += 1
if self.speed > 8:
self.speed = 8
def slower(self):
self.speed -= 1
if self.speed < 1:
self.speed = 1

yesveryprofesionalnameyes
Автор

why do we use sprite class instead of turtle class

scuffedgod
Автор

Thanks, Working 99% things in Python 3.7.0.
Is there any method to make turning smoother, Like rotate in loop until I hold down key and stop when I release key

prateekpanwar
Автор

hello christian...up until now all the tutorials of yours that I have seen dont include classes...we either directly defined the game objects using turtle or we did it through def function....i am trying my best to keep up with up your explanation of classes, child and converting the code to 3.7 for windows...however would you please tell me what is __init__?...i heard you call it constructor?...can we name it someting else?...or is __init__ the only name?...also what does the next line mean(line 24)?...i know its a lot of questions however a small explanation would suffice...Thank You and keep up the good work!

adwaitmhatre
Автор

it keeps saying theres a error with the def _ init _ part *i put spaces because it didn't show the underscores in the comment*




"in __init__
self.undobuffer = Tbuffer(undobuffersize)"

valentinavera
Автор

Is there a way to change the keyboard input from the arrow keys to WASD?

larrywu
Автор

i thought fd(0) was something for mac, but later u use it to move the player, i don't understand

rodrigonedel
Автор

is there a reason not to import with "from __ import *"? if u do this u don't need to write when using commands
example:
import random
u need to write random.___

rodrigonedel
Автор

What does while True do? Any difference without it?

lmali
Автор

i am getting an error message:

Traceback (most recent call last):
File "C:\Users\sudar\AppData\Local\Programs\Python\Python38-32\SpaceWar.py", line 39, in <module>
player = Player("triangle", "white", 0, 0)
File "C:\Users\sudar\AppData\Local\Programs\Python\Python38-32\SpaceWar.py", line 33, in __init__
Sprite.Turtle.__init__(self, spriteshape, color, startx, starty)
AttributeError: type object 'Sprite' has no attribute 'Turtle'

can you send your code and then i can compare it with mine???
pls reply 🙏

sakmancap
Автор

I thought turtle.fd(0) is to pop up the window for mac, but what self.fd(self.speed) does and how it can set the moving speeding for the Sprite?

lmali
Автор

Good Day Sir. Thank you for this series. I tried to double check my code in yours. I am trying to figure out, why my Up and Down onkeys doesnt work :(. Hope you can correct me. I'm so confused.

rizalybeniga
Автор

Hey, my onkey is only working on realesed and not pressed. Is there any way to fix this for future refrence without it causing to much trouble? Otherwise great stuff man!

zit
Автор

Hi Christian thanks for helping me on Space Invaders before and it worked fine. Now, I'm facing an error in Space Wars where it says


File "Space Wars.py", line 40
def turn_left(self):


hope you can help me to solve it Thank You

arvindganesh
Автор

doestnt work. too many bugs in code. guess thast what i get for using a videoe from 8 years ago

buhqnbd
join shbcf.ru