import retro (update) class Runner: name = "[selected characters name]" character = '0' characters = ["Sonic", "Tails", "Knuckles", "Amy", "Shadow", "Silver", "Surge", "Rouge", "Jet"] print("Choose a character:") for i, char in enumerate(characters): print(f"{i+1}, {char}") choice = int(input("Enter number: ")) selected_character = character[choice - 1] print("You chose:", selected_character) character_colors = { #find the numbers needed for the colours + feel free to add more characters "Sonic": (0, 0, 255), #blue "Tails": (225, 255, 0), #yellow "Knuckles": (255, 0, 0), #red "Amy": (255, 192, 203), #pink "Shadow": (0, 0, 0), #black "Silver": (211, 211, 211), #light grey "Surge": (144, 238, 144), #light green "Rouge": (255, 255, 255), #white "Jet": (0, 128, 0), #green "Cream": (245, 245, 220), #creamy beige (use '240, 230, 200' if this colour doesn't work) "Super Sonic": (255, 255, 224) #light yellow "Super Shadow": (255, 255, 240) #pale yellow } selected_character = "" player_color = character_colors{selected_character} def __init__(self): self.y = 450 self.width = 40 self.height = 60 self.lanes = [250, 400, 550] self.current_lane = 1 self.x = self.lanes[self.current_lane] self.forward_speed = 5 self.lane_switch_speed = 10 def move_left(self): if self.current_lane > 0: self.current_lane -= 1 def move_right(self): if self.current_lane < len(self.lanes) - 1: self.current_lane += 1 def update(self): self.y -= self.forward_speed target_x = self.lanes[self.current_lane] if self.x < target_x: self.x += self.lane_switch_speed if self.x > target_x: self.x = target_x elif self.x > target_x: self.x -= self.lane_switch_speed if self.x < target_x: self.x = target_x def draw(self, screen): retro.draw.rect( screen, (0, 200, 255), (self.x, self.y, self.width, self.height))