shooter game
unknown
plain_text
2 years ago
1.0 kB
7
Indexable
import random
score = 0
ammo = 10
while ammo > 0:
print("Enemies incoming! Choose your target: ")
print("1. Enemy soldier")
print("2. Enemy vehicle")
print("3. Helicopter")
target = int(input("Enter your choice: "))
if target in [1, 2, 3]:
ammo -= 1
enemy_type = random.choice(["soldier", "vehicle", "helicopter"])
if target == 1 and enemy_type == "soldier":
print("You eliminated an enemy soldier!")
score += 10
elif target == 2 and enemy_type == "vehicle":
print("You destroyed an enemy vehicle!")
score += 20
elif target == 3 and enemy_type == "helicopter":
print("You shot down an enemy helicopter!")
score += 30
else:
print("You missed the target!")
print(f"Ammo left: {ammo}")
print(f"Current score: {score}\n")
else:
print("Invalid choice! Try again.\n")
print("Out of ammo! Game over.")
print(f"Final score: {score}")Editor is loading...
Leave a Comment