Infinite Runner with Obstacles Script Added#2650
Merged
1e9abhi1e10 merged 1 commit intoavinashkranjan:masteravinashkranjan/Amazing-Python-Scripts:masterfrom Aug 8, 2023
andoriyaprashant:branch28andoriyaprashant/Amazing-Python-Scripts:branch28Copy head branch name to clipboard
Merged
Infinite Runner with Obstacles Script Added#26501e9abhi1e10 merged 1 commit intoavinashkranjan:masteravinashkranjan/Amazing-Python-Scripts:masterfrom andoriyaprashant:branch28andoriyaprashant/Amazing-Python-Scripts:branch28Copy head branch name to clipboard
1e9abhi1e10 merged 1 commit intoavinashkranjan:masteravinashkranjan/Amazing-Python-Scripts:masterfrom
andoriyaprashant:branch28andoriyaprashant/Amazing-Python-Scripts:branch28Copy head branch name to clipboard
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The "Infinite Runner with Customizable Obstacles" script is a Python game implemented using the Pygame library. It creates a simple and endless runner-style game where the player controls a character moving horizontally and vertically to avoid obstacles. The objective is to survive as long as possible while accumulating points by running and avoiding collisions with obstacles.
Here's a step-by-step description of the script:
Initialization and Setup: The script starts by initializing Pygame and setting up the game window (display) with specified dimensions.
Loading Assets: The script loads the required assets for the game, such as the background music, jumping sound effect, and collision sound effect. These assets are used throughout the game to provide audio feedback to the player.
Game Loop: The main part of the script is the game loop, which runs continuously until the game is exited. The loop handles user input, updates the game state, and redraws the screen.
Player Control: The player can control the character using the left and right arrow keys to move horizontally and the spacebar to make the character jump. Gravity is applied to the character, causing it to fall back down after a jump.
Obstacle Generation: The game generates obstacles randomly. Three types of obstacles are available: rectangular, triangular, and rotating circular obstacles. Each type of obstacle moves differently, adding variety to the game.
Collision Detection: The script checks for collisions between the player character and the obstacles. If a collision occurs, the game ends, and a collision sound effect is played.
Scoring: The game includes a scoring system. The player earns points continuously as the character runs, and the score is displayed on the screen.
Rendering: The script clears the screen and redraws the player character, obstacles, and the score on the game window in each iteration of the game loop.
Customization: The script encourages customization. Developers can modify the obstacle generation and update logic to create their obstacle types or enhance gameplay.
Exiting the Game: The game loop continues until the player exits the game window or closes the game window, at which point the script quits Pygame and terminates the game.
Fixes #2648
Type of change
Checklist:
README.mdTemplate for README.mdrequirements.txtfile if needed.Project Metadata
Category:
Title: Infinite Runner with Customizable Obstacles
Folder: Infinite Runner with Customizable Obstacles
Requirements:
Script: infinite_runner.py
Contributor: andoriyaprashant
Description: Infinite Runner with Obstacles Script Added