Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i post the what i tried to do code below. Would you solve this problem from my c

ID: 3718709 • Letter: I

Question

i post the what i tried to do code below. Would you solve this problem from my code?

Problem 3 (50 XP) Modify the Asteroids game so that there are three different asteroids, a large, a medium and a small asteroid, that move in random directions at the beginning of the game. Do so by using three distinct images, creating 15 random goals (change maxGoals to 15), and making sure that there are 5 of each small, medium and large size asteroids by using three distinct image sizes. [Hint: Find .gif images files online and register them with the turtle)

Explanation / Answer

# game # Turtle Graphics Game import turtle import math import random import os # Set up screen wn = turtle.Screen() wn.bgcolor("black") wn.bgpic("bgpic.gif") wn.tracer(3) wn.addshape("asteroid.gif") # 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 the life variable # Create goals maxGoals = 15 #Here you have modified maxGOALS TO 15 goals = [] #add gif x1 = "circle1.gif" # here you have added three different sizes of asteroids wn.addshape(x1) x2 = "circle2.gif" wn.addshape(x2) x3 = "circle3.gif" wn.addshape(x3) for count in range(maxGoals): goals.append(turtle.Turtle()) goals[count].color("red") #Here you have made sure there are 5 each of 3 differenet asteroidw goals[count].shape(x1) goals[count].shape(x2) goals[count].shape(x3) 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 < 20: return True else: return False # Set keyboard bindings turtle.listen() turtle.onkey(turnleft, "Left") turtle.onkey(turnright, "Right") turtle.onkey(increasespeed, "Up") turtle.onkey(decreasespeed, "Down") while True: player.forward(speed) # Boundary Checking if player.xcor() > 300 or player.xcor() < -300: player.goto(0, 0) # when the ball hit the boundary, the ball start at the center(beginning point) --> quizz life -= 1 #player.right(180) os.system("afplay bounce.mp3&") # Boundary Checking if player.ycor() > 300 or player.ycor() < -300: player.goto(0, 0) life -=1 #player.right(180) os.system("afplay bounce.mp3&") # Move the goal for count in range(maxGoals): goals[count].forward(3) # Boundary Checking if goals[count].xcor() > 290 or goals[count].xcor() < -290: goals[count].right(180) os.system("afplay bounce.mp3&") # Boundary Checking if goals[count].ycor() > 290 or goals[count].ycor() < -290: goals[count].right(180) os.system("afplay bounce.mp3&") # Collision checking if isCollision(player, goals[count]): goals[count].setposition(random.randint(-300, 300), random.randint(-300, 300)) goals[count].right(random.randint(0, 360)) os.system("afplay collision.mp3&") score += 1 # Draw the score on the screen mypen.undo() mypen.penup() mypen.hideturtle() mypen.setposition(-290, 310) scorestring = "Score: {0}".format(score) mypen.write(scorestring, False, align="left", font=("Arial", 14, "normal")) #delay = input("Press Enter to finish.")