Python Game Programming Tutorial: SpaceWar 4

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

I have a better def is_collision:
fro = int(self.xcor() - enemy.xcor())
vro = int(enemy.xcor() - self.xcor())
if fro in range(-20, 20):
enemy.color("blue")
time.sleep(0.25)
enemy.color("red")
time.sleep(0.25)
return enemy.move1()

govindarajanks
Автор

I'm having trouble it says
Exception has occurred: AttributeError



'Enemy' object has no attribute 'move'
File "/Users/newuser/space war shooter game", line 118, in <module>
enemy.move()

abigurl
Автор

how to know if this is good tutorial

*_red circle as enemy_*

pythonicperson
Автор

Oops! I forgot to indent def is_collision and was wondering why 'Player' object has no attribute 'is_collision' was an error! Anyways, i'm loving the tutorials!

peanutpickled
Автор

Why did you use this
def is_collision(self, other):
if (self.xcor() >= (other.xcor() - 20)) and \
(self.xcor() <= (other.xcor() + 20)) and \
(self.ycor() >= (other.ycor() - 20)) and \
(self.ycor() <= (other.ycor() + 20)):
return True
else:
return False
instead of this
def isCollision(t1, t2):
distance = math.sqrt(math.pow(t1.xcor() - t2.xcor(), 2) + math.pow(t1.ycor() - t2.ycor(), 2))
if distance < 15:
return True
else:
return False

for you function. (The latter one came from your space invader tutorial) just curious?

TheJojoPh
Автор

CAN YOU PLEASE TELL WHAT IS THE SULUTION FOR THIS ERROR- File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1338, in _bind
self.tk.call(what + (sequence, cmd))
_tkinter.TclError: bad event type or keysym "left"



(program exited with code: 1)

Press any key to continue . . .

krishanggohel
Автор

hey christian, just wandering but when i speed up my player, it shrinks as i'm accelerating. Why is this happening?
ps. great work on the channel :)

olliegosling
Автор

can we name the classes whatever we want ???

scuffedgod
Автор

Help me!
I'm creating this code to 2 player...
how to make both of the player collide?

muazhazimi
Автор

Hello Mate, how do I change the shape of the player to a sprite?

thomasbutler
Автор

for collision, I beliave Pythagorean Theorem much better way to do that, whic I learned from you =)

klarex
Автор

Is there a way to make it easier to tell which direction your facing

shesluvinvon
Автор

Do you use any book to learning more about turtle graphics module(codes) ?

xrl
Автор

at the check for a collision part when i run it if iam not touching it it teliports somewhere else what to do?

richboy
Автор

Hey Christian. I got somewhere error in code. Can I have a look at your source code? Some link to it? Thanks.

eccololo
Автор

my computer is giving me if (self.xcor() >= (other.xcor - 20)) and \
TypeError: unsupported operand type(s) for -: 'method' and 'int' . Can you please help me?

blazebro-lwgs
Автор

At the end of my code, I put a enemy.move() and it does nothing, my code is the same to yours and I have no idea what is going on. The red circle won’t move and I’m stuck.

gorgestboi
Автор

Hi Christian can I recommend another game to do. Can you do packman please

henrytebbs
Автор

Sir can u make a program on traffic light working system plzz

naveenpoonia
Автор

wasd controles are better but i will keep arrow keys bcz from some reason when i change something in code it dosen't work yeah... (-_-)

yesveryprofesionalnameyes
welcome to shbcf.ru