Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Infinite Runner with Obstacles Script Added#2650

Merged
1e9abhi1e10 merged 1 commit intoavinashkranjan:masteravinashkranjan/Amazing-Python-Scripts:masterfrom
andoriyaprashant:branch28andoriyaprashant/Amazing-Python-Scripts:branch28Copy head branch name to clipboard
Aug 8, 2023
Merged

Infinite Runner with Obstacles Script Added#2650
1e9abhi1e10 merged 1 commit intoavinashkranjan:masteravinashkranjan/Amazing-Python-Scripts:masterfrom
andoriyaprashant:branch28andoriyaprashant/Amazing-Python-Scripts:branch28Copy head branch name to clipboard

Conversation

@andoriyaprashant
Copy link
Contributor

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

  • New feature

Checklist:

  • My code follows the style guidelines(Clean Code) of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have created a helpful and easy to understand README.md
  • My documentation follows Template for README.md
  • I have added the project meta data in the PR template.
  • I have created the requirements.txt file if needed.

Project Metadata

Category:

  • Calculators
  • AI/ML
  • Scrappers
  • Social_Media
  • PDF
  • Image_Processing
  • Video_Processing
  • Games
  • Networking
  • OS_Utilities
  • Automation
  • Cryptography
  • Computer_Vision
  • Fun
  • Others

Title: Infinite Runner with Customizable Obstacles

Folder: Infinite Runner with Customizable Obstacles

Requirements:

  • pygame
  • random

Script: infinite_runner.py

Contributor: andoriyaprashant

Description: Infinite Runner with Obstacles Script Added

@1e9abhi1e10 1e9abhi1e10 added level3 New features, Major bug fixing gssoc23 Issues created for/by the GirlScript Summer of Code'23 Participants labels Aug 8, 2023
@1e9abhi1e10 1e9abhi1e10 merged commit b25ce3d into avinashkranjan:master Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc23 Issues created for/by the GirlScript Summer of Code'23 Participants level3 New features, Major bug fixing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Script]: Infinite Runner with Customizable Obstacles

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.