import pygame import sys import random import os color = (255, 255, 255) base_path = os.path.dirname(__file__) # Function to load an image def load_image(image_name): return pygame.image.load(os.path.join(base_path, image_name)) skibidi_img = load_image('skibidi.jpg') skibidi_img = pygame.transform.scale(skibidi_img, (450, 240)) def bouncing_rect(): global x_speed, y_speed, color move_rect.x += x_speed move_rect.y += y_speed # Collisions if move_rect.right >= screen_w or move_rect.left <= 0: x_speed *= -1 pygame.display.flip() if move_rect.bottom >= screen_h or move_rect.top <= 0: y_speed *= -1 pygame.display.flip() screen.blit(skibidi_img, move_rect) pygame.init() clock = pygame.time.Clock() screen_w, screen_h = 1920, 1080 screen = pygame.display.set_mode((screen_w, screen_h)) move_rect = pygame.Rect(350, 350, 450, 240) x_speed, y_speed = 7, 5 while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: print("key_board input -> Exit") pygame.quit() sys.exit() screen.fill((30, 30, 30)) bouncing_rect() pygame.display.flip() clock.tick(60)