+ 12
I need help with the Shooting game (Solved)
I have been stuck on shooting game for hours, I did my code right but it’s not working please give me the answer https://code.sololearn.com/cKqQown88vf7/?ref=app
6 Respuestas
+ 4
Please send your code and then we may be able to help you.
+ 5
# Corrected Code By Sancho Godinho:
class Enemy:
name = ""
lives = 0
def __init__(self, name, lives):
self.name = name
self.lives = lives
def hit(self):
self.lives -= 1
if self.lives <= 0:
print(self.name +' kiled')
else:
print(self.name + ' has '+ str(self.lives)+ ' lives ')
m = Enemy('Monster',3)
a = Enemy ('Ailen',5)
while True:
x = input()
if x == 'exit':
break
elif x== 'laser':
a.hit()
else:
m.hit()
+ 3
AkiQ8
You Have Actually Done A Lot Of Mistakes...
But, You Can Copy & Paste My Other Answer As Your Code...
+ 3
Thanks all of you for helping me out may Allah bless all of you with heaven