import time
import random
def game():
print("🏃♂️ Welcome to the Text-Based Jump Game!")
print("Type 'jump' when you see an obstacle!\\n")
score = 0
for i in range(1, 11):
time.sleep(1)
obstacle = random.choice(\[True, False\])
if obstacle:
print(f"Obstacle {i} ahead! Type 'jump': ", end='')
action = input().strip().lower()
if action == "jump":
print("✅ You jumped over it!\\n")
score += 1
else:
print("❌ You hit the obstacle!\\n")
else:
print(f"No obstacle {i}. Keep running!\\n")
score += 1
print(f"🏁 Game over! Your final scocoin = pygame.Rect(300, 310, 20, 20)
# In the draw section:
pygame.draw.rect(screen, (255, 215, 0), coin) # Gold color
# Collision check:
if player.colliderect(coin):
print("Coin collected!")re: {score}/10")
game()