Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Google's advanced image search to find a reasonably-sized image of a ball that is free to reuse and that includes transparency. Modify the sample

  1. Use Google's advanced image search to find a reasonably-sized image of a ball that is free to reuse and that includes transparency. Modify the sample code so that your ball slides back and forth across the bottom of the screen. It should take 2 seconds for the ball to go from the left side to the right.
  2. Improve your animation for question 5 so that the ball rotates, accurately, as if it were rolling back and forth.
  3. Modify your animation for question 6 so that the ball travels counterclockwise around the edge of the screen

  1. image text in transcribedimage text in transcribed

** The above pictures are the skeleton code **

Please have the code of each question individual

"Some simple skeleton code for a pygame game/animation This skeleton sets up a basic 80ex600 window, an event loop, and a redraw timer to redraw at 30 frames per second import math import sys import pygame class MyGame (object): def init (self) ""Initialize a new game"" pygame.mixer.init() pygame.mixer.pre_init(4410e, -16, 2, 2048) pygame.init() # set up a 640 x 480 window self.width 800 self.height 600 self. screen#pygame . display . set-mode((self"width, self. height)) # Setup any internal variables and Load any resources self.bg. Color = , , self.frame nume # Setup a timer to refresh the display FPS times per second self. FPS 30 self. REFRESH = pygane.USEREVENT+1 pygame.time.set timer (self.REFRESH, 1000//self.FPS) def run (self): Loop forever processing events"" running True while running: event pygame.event.wait() # player is asking to quit if event.type pygame.QUIT runningFalse # time to draw a new frame elif event.typeself.REFRESH: self.update() self.draw() else: pass # an event type we don't handle def update(self): ""Update game objects"" " self.frame num += 1 def draw(self): "Draw the next frame" # everything we draw now is to a buffer that is not displayed self.screen.fill(self.bg color) # flip buffers so that everything we have drawn gets displayed pygame.display.flip() game - MyGame () game.run() print("Quitting game after pygame.quit) sys.exit() frames".format(game.frame_num))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

Students also viewed these Databases questions

Question

b. Why were these values considered important?

Answered: 1 week ago