GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Which of the following is a potential complication of untrea…

Which of the following is a potential complication of untreated Haemophilia?

Read Details

Which event contributed to the widespread distrust of labor…

Which event contributed to the widespread distrust of labor unions due to its association with violence? (Learning Skill 8)

Read Details

How did the Civil Rights Movement of the 1950s and 1960s tra…

How did the Civil Rights Movement of the 1950s and 1960s transform American society? Provide specific examples of key events, legislation, and leaders. (Learning Skill 10)

Read Details

How did the Open-Door Policy affect U.S. relations with Chin…

How did the Open-Door Policy affect U.S. relations with China? (Learning Skill 9)

Read Details

What was one of the key purposes of the GI Bill of Rights fo…

What was one of the key purposes of the GI Bill of Rights following World War II? (Learning Skill 10)

Read Details

Which of the following was a direct result of industrializat…

Which of the following was a direct result of industrialization in the United States during the late 19th century?

Read Details

The Cold War began largely because of tensions between which…

The Cold War began largely because of tensions between which two superpowers? (Learning Skill 10)

Read Details

How did the United States contribute to the Allied victory i…

How did the United States contribute to the Allied victory in World War II before formally entering the war? (Learning Skill 9)

Read Details

It is essential that the patient’s dental record regarding t…

It is essential that the patient’s dental record regarding the exposure of dental radiographs includes: A.  informed consent B.  the number and type of images exposed, including retakes C.  the rationale for the imaging procedure D.  diagnostic information obtained from the image interpretation

Read Details

For the next 7 questions, refer to the following code: # 1 -…

For the next 7 questions, refer to the following code: # 1 – Import packagesimport pygame, sys, random# 2 – Define constantsWINDOW_WIDTH = 640WINDOW_HEIGHT = 480FRAMES_PER_SECOND = 30C1 = (0, 0, 0)C2 = (255, 255, 255)C3 = (255, 0, 0)N_PIXELS_TO_MOVE = 5# 3 – Initialize the worldpygame.init()window = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))clock = pygame.time.Clock()# 4 – Load assets: image(s), sound(s),  etc.ballImage = pygame.image.load(‘images/ball.png’)bounceSound = pygame.mixer.Sound(‘sounds/boing.wav’) # 5 – Initialize variablesballX = 50ballY = 350ballSide = 100ballRect = pygame.Rect(50, 350, 100, 100)maxBallX = WINDOW_WIDTH – ballSidemaxBallY = WINDOW_HEIGHT – ballSidecircleX = 100circleY = 50circleRadius = 30circleRect = pygame.Rect(70, 20, 60, 60)# 6 – Loop foreverwhile True:   # 7 – Check for and handle events    for event in pygame.event.get():        if event.type == pygame.QUIT:                       pygame.quit()              sys.exit()        if event.type == pygame.MOUSEBUTTONDOWN:            if ballRect.collidepoint(event.pos):                ballX = random.randrange(WINDOW_WIDTH – ballSide)                ballY = random.randrange(WINDOW_HEIGHT – ballSide)                ballRect = pygame.Rect(ballX, ballY, ballSide, ballSide)            if circleRect.collidepoint(event.pos):                circleX = random.randrange(circleRadius, WINDOW_WIDTH – circleRadius)                circleY = random.randrange(circleRadius, WINDOW_HEIGHT – circleRadius)   # 8 – Do any “per frame” actions   keyPressedTuple = pygame.key.get_pressed()           if keyPressedTuple[pygame.K_LEFT]:          if ballX == 0:            bounceSound.play()         elif ballX < N_PIXELS_TO_MOVE:            ballX = 0        else:            ballX = ballX - N_PIXELS_TO_MOVE    if keyPressedTuple[pygame.K_RIGHT]:          if ballX == maxBallX:            bounceSound.play()         elif ballX > maxBallX – N_PIXELS_TO_MOVE:            ballX = maxBallX        else:            ballX = ballX + N_PIXELS_TO_MOVE    if keyPressedTuple[pygame.K_UP]:          if ballY == 0:            bounceSound.play()         elif ballY < N_PIXELS_TO_MOVE:            ballY = 0        else:            ballY = ballY - N_PIXELS_TO_MOVE    if keyPressedTuple[pygame.K_DOWN]:          if ballY == maxBallY:            bounceSound.play()         elif ballY > maxBallY – N_PIXELS_TO_MOVE:            ballY = maxBallY        else:            ballY = ballY + N_PIXELS_TO_MOVE                ballRect = pygame.Rect(ballX, ballY, ballSide, ballSide)       # 9 – Clear the window    window.fill(C2)        # 10 – Draw all window elements    window.blit(ballImage, (ballX, ballY))       circleRect = pygame.draw.circle(window, C3, (circleX, circleY), circleRadius, 0)     # 11 – Update the window    pygame.display.update()    # 12 – Slow things down a bit   clock.tick(FRAMES_PER_SECOND)  

Read Details

Posts pagination

Newer posts 1 … 37,407 37,408 37,409 37,410 37,411 … 85,729 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top