Question: Given Asteroids.py(python) code below, # game # Turtle Graphics Game import turtle import math import random import os import winsoun # Set up screen wn

 Given Asteroids.py(python) code below, # game # Turtle Graphics Game import

Given Asteroids.py(python) code below,

# game # Turtle Graphics Game import turtle import math import random import os import winsoun # Set up screen wn = turtle.Screen() wn.bgcolor("black") wn.bgpic("bgpic.gif") wn.tracer(3) # Draw border mypen = turtle.Turtle() mypen.color("white") mypen.penup() mypen.setposition(-300, -300) mypen.pendown() mypen.pensize(3) for side in range(4): mypen.forward(600) mypen.left(90) mypen.hideturtle() # mypen can be reused... will be used to draw score on the screen # Create player turtle player = turtle.Turtle() player.color("blue") player.shape("triangle") player.penup() player.speed(0) # Create the score variable score = 0 # Create goals maxGoals = 10 goals = [] for count in range(maxGoals): goals.append(turtle.Turtle()) goals[count].color("red") goals[count].shape("turtle") goals[count].penup() goals[count].speed(0) goals[count].setposition(random.randint(-300, 300), random.randint(-300, 300)) goals[count].right(random.randint(0,360)) # Set speed variable speed = 1 # Define functions def turnleft(): player.left(30) def turnright(): player.right(30) def increasespeed(): global speed speed += 1 def decreasespeed(): global speed if speed > 1: speed -= 1 def isCollision(t1, t2): d = math.sqrt(math.pow(t1.xcor() - t2.xcor(), 2) + math.pow(t1.ycor() - t2.ycor(), 2)) if d  300 or player.xcor()  quizz #player.right(180) os.system("afplay bounce.mp3&") # Boundary Checking if player.ycor() > 300 or player.ycor()  290 or goals[count].xcor()  290 or goals[count].ycor()  

Question: I appreciate if you solve the problem by following information and code. If you want to type different code, would you take screenshot yours?

Problem 4 (50 XP): Modify the Asteroids game so that the game ends after the playes loses 3 lives. Create a lives counter, and substract a life every time the players touches a boundary. Problem 4 (50 XP): Modify the Asteroids game so that the game ends after the playes loses 3 lives. Create a lives counter, and substract a life every time the players touches a boundary

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!