Shinobi555 / Hacktoberfest_2k24

A small repo for all who want to participate in hacktoberfest2024
MIT License
0 stars 1 forks source link

Add files via upload #3

Closed kiranHR closed 20 hours ago

kiranHR commented 21 hours ago

This script is an automation tool for the Google Chrome offline Dino Game, where the goal is to avoid obstacles like cacti and birds. Here’s a brief summary of how it works:

1.  Libraries: •    pyautogui: Used to simulate keyboard presses (e.g., jump and duck). •   PIL (Pillow): Captures the screen and converts it to grayscale for processing.
2.  Functions: •    hit(key): Simulates a key press (either “up” for jumping or “down” for ducking). •  isCollide(data): Detects obstacles (birds and cacti) based on pixel values from the captured screen. If an obstacle is detected, it calls hit() to respond (jump or duck).
3.  Main Game Loop: •   The script starts by displaying a countdown before starting the game. • It captures the game screen repeatedly, checks for obstacles using isCollide(), and simulates appropriate actions (jump or duck) to avoid them.

The script automates the gameplay by continuously capturing the game screen and responding to obstacles in real-time.