Please provide proper indentation import pygame import sys Set up display screen =…
- User
Please provide proper indentation import pygame import sys
Set up display
screen = pygame.display.set_mode((900, 700))
Set up colors (RGB format)
kirby_pink_color = (255, 105, 180) kirby_yellow_color = (0,0,0) ground_color = (0, 255, 0)
Kirby properties
circle_radius1 = 25 # Initial radius circle_radius2 = 25 # Initial radius circle_y_offset1 = 25 # Offset from the top of the circle circle_y_offset2 = 25 # Offset from the top of the circle crouch_scale1 = 0.5 # Scale factor for crouching crouch_scale2 = 0.5 # Scale factor for crouching
Kirby1 position and velocity
kirby1_x, kirby1_y = 425, 500 kirby1_x_speed, kirby_y_speed1 = 0, 0 gravity1 = 1 jump_height1 = -15 # Set jump height
Kirby2 position and velocity
kirby2_x, kirby2_y = 425, 500 kirby2_x_speed, kirby2_y_speed = 0, 0 gravity2 = 1 jump_height2 = -15 # Set jump height
Kirby1 crouching and in air states
is_crouching1 = False in_air1 = False
Kirby2 crouching and in air states
is_crouching2 = False in_air2 = False
Kirby1 movement flags
is_moving_left1 = False is_moving_right1 = False is_floating1 = False
Kirby 2 movement flags
is_moving_left2 = False is_moving_right2 = False is_floating2 = False
Load the Kirby face image
kirby_face = pygame.image.load(“kirby_face.png”)
Game loop
while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_s and not is_crouching1: is_crouching1 = True elif event.key == pygame.K_w and not in_air1: kirby_y_speed1 = jump_height1 in_air1 = True elif event.key == pygame.K_e and not is_crouching1: is_floating1 = True elif event.key == pygame.K_r: is_floating1 = False elif event.key == pygame.K_a: is_moving_left1 = True elif event.key == pygame.K_d: is_moving_right1 = True elif event.type == pygame.KEYUP: if event.key == pygame.K_s: is_crouching1 = False elif event.key == pygame.K_a: is_moving_left1 = False elif event.key == pygame.K_d: is_moving_right1 = False
Kirby1 Floating set up
if is_floating1: gravity1 = 0.3 jump_height1 = -6.5 in_air1 = False is_crouching1 = False circle_radius1 = 35 circle_y_offset1 = 35 else: gravity1 = 1 jump_height1 = -15 in_air1 = True circle_radius1 = 25 circle_y_offset1 = 25
Kirby2 Floating set up
if is_floating2: gravity2 = 0.3 jump_height2 = -6.5 in_air2 = False is_crouching2 = False circle_radius2 = 35 circle_y_offset2 = 35 else: gravity2 = 1 jump_height2 = -15 in_air2 = True circle_radius2 = 25 circle_y_offset2 = 25
Apply gravity to Kirby1
kirby_y_speed1 += gravity1
Apply gravity to Kirby2
- Assistant