Skip to content

hk2166/MarioByGesture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gesture Controlled Games

This project allows you to play web-based games (specifically configured for "Steve's World") using hand gestures captured by your webcam. It combines a webview for the game and a background process for gesture recognition.

Features

  • Gesture Control: Control the game character using hand movements.
  • Integrated Browser: Launches the game directly in a dedicated window.
  • Real-time Tracking: Uses MediaPipe and OpenCV for fast and accurate hand tracking.

Compatible Games

You can play various side-scrolling or platformer games. Here are some recommended ones:

To switch games, edit the url parameter in app.py.

Controls

The following hand gestures are mapped to game actions:

Gesture Action
Pinky Finger Up Move Right
Index Finger Up Move Left
All Fingers Up Jump
Pinky + Ring Fingers Up Jump + Move Right
Index + Middle Fingers Up Jump + Move Left

Prerequisites

  • Python 3.x
  • A working webcam

Installation

  1. Clone the repository or download the source code.

  2. Install the required Python packages:

    pip install opencv-python mediapipe pyautogui pywebview

Usage

  1. Play Steve's World Run app.py to play "Steve's World" as it is defined in the project. This launches the game in a dedicated window with controls ready to go.

    python app.py
  2. Universal Game Control Run gesture_control.py to use the gesture controls for any other game (like Mario) running in your browser. This starts the camera tracking so you can control any game that uses the mapped keys.

    python gesture_control.py

How it Works

  • app.py: The main entry point. It launches a pywebview window to display the game and starts the gesture control script as a subprocess. It handles the lifecycle of the application, ensuring the gesture controller stops when the window is closed.
  • gesture_control.py: Captures video frames, processes them with MediaPipe to detect hand landmarks, and simulates keyboard presses using PyAutoGUI based on the detected gestures.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages