Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with code in python, please draw a shark in pygame.draw, make it very small. the screen width / height are 8 0
I need help with code in python, please draw a shark in pygame.draw, make it very small. the screen widthheight are Dont load an image make the effort to draw lines and draw shapes. Ive included the code of a red square and it should be approximately the same size.
import pygame
# Define some colors
BLACK
WHITE
GREEN
RED
pygame.init
# Set the width and height of the screen width height
size
screen pygame.display.setmodesize
pygame.display.setcaptionMy Game"
# Loop until the user clicks the close button.
done False
# Used to manage how fast the screen updates
clock pygame.time.Clock
# Main Program Loop
while not done:
# Main event loop
for event in pygame.event.get:
if event.type pygame.QUIT:
done True
# Game logic should go here
# Screenclearing code goes here
# Here, we clear the screen to white. Don't put other drawing commands
# above this, or they will be erased with this command.
# If you want a background image, replace this clear with blit'ing the
# background image.
screen.fillWHITE
# Drawing code should go here
pygame.draw.rectscreenRED,
# Go ahead and update the screen with what we've drawn.
pygame.display.flip
# Limit to frames per second
clock.tick
# Close the window and quit.
pygame.quit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started