Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/update-index.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Update Game Index

on:
push:
branches: [ main, master ]
Expand All @@ -8,28 +9,32 @@ on:
jobs:
update-index:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

fetch-depth: 0 # Important for pushing commits back

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Update INDEX.md
run: |
python update_index.py
- name: Commit changes

- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add INDEX.md

if [[ -n "$(git status --porcelain INDEX.md)" ]]; then
git commit -m "Auto-update INDEX.md with new games [skip ci]"
git push
git push origin HEAD:${GITHUB_REF#refs/heads/}
else
echo "No changes to INDEX.md"
fi
6 changes: 3 additions & 3 deletions INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

Welcome to Game_Scripts — an open-source collection of mini games!
This index automatically tracks all games across different programming languages.
Last updated: Fri Oct 17 14:33:32 UTC 2025

Tracked 26 games across 3 languages.

## 📚 Table of Contents
- [Java](#java-games)
Expand All @@ -16,6 +14,9 @@ Tracked 26 games across 3 languages.
### 🎯 [BrickBreakingGame](./Java/BrickBreakingGame/)
A fun game built with core programming concepts

### 🎯 [FlappyBird](./Java/FlappyBird/)
FlappyBird Game

### 🎯 [Hangman](./Java/Hangman/)
🎮 Hangman GUI Game

Expand Down Expand Up @@ -58,7 +59,6 @@ A fun game built with core programming concepts
A simple yet elegant web-based stopwatch application with start, stop, and reset functionality.

### 🎯 [Typing Speed Game](./Javascript/Typing Speed Game/)
A fast-paced browser game built with HTML, CSS, and JavaScript. Words fall from the top of the screen — type them before they hit the bottom! Designed to improve typing speed, accuracy, and reflexes.

### 🎯 [Weather Site](./Javascript/Weather Site/)
A fun game built with core programming concepts
Expand Down
21 changes: 21 additions & 0 deletions Java/FlappyBird/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import javax.swing.*;

public class App {
public static void main(String[] args) throws Exception {
int boardWidth = 360;
int boardHeight = 640;

JFrame frame = new JFrame("Flappy Bird");
// frame.setVisible(true);
frame.setSize(boardWidth, boardHeight);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

FlappyBird flappyBird = new FlappyBird();
frame.add(flappyBird);
frame.pack();
flappyBird.requestFocus();
frame.setVisible(true);
}
}
215 changes: 215 additions & 0 deletions Java/FlappyBird/FlappyBird.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.*;

public class FlappyBird extends JPanel implements ActionListener, KeyListener {
int boardWidth = 360;
int boardHeight = 640;

// images
Image backgroundImg;
Image birdImg;
Image topPipeImg;
Image bottomPipeImg;

// bird class
int birdX = boardWidth / 8;
int birdY = boardHeight / 2;
int birdWidth = 34;
int birdHeight = 24;

class Bird {
int x = birdX;
int y = birdY;
int width = birdWidth;
int height = birdHeight;
Image img;

Bird(Image img) {
this.img = img;
}
}

// pipe class
int pipeX = boardWidth;
int pipeY = 0;
int pipeWidth = 64; // scaled by 1/6
int pipeHeight = 512;

class Pipe {
int x = pipeX;
int y = pipeY;
int width = pipeWidth;
int height = pipeHeight;
Image img;
boolean passed = false;

Pipe(Image img) {
this.img = img;
}
}

// game logic
Bird bird;
int velocityX = -4; // move pipes to the left speed (simulates bird moving right)
int velocityY = 0; // move bird up/down speed.
int gravity = 1;

ArrayList<Pipe> pipes;
Random random = new Random();

Timer gameLoop;
Timer placePipeTimer;
boolean gameOver = false;
double score = 0;

FlappyBird() {
setPreferredSize(new Dimension(boardWidth, boardHeight));
// setBackground(Color.blue);
setFocusable(true);
addKeyListener(this);

// load images
backgroundImg = new ImageIcon(getClass().getResource("./flappybirdbg.png")).getImage();
birdImg = new ImageIcon(getClass().getResource("./flappybird.png")).getImage();
topPipeImg = new ImageIcon(getClass().getResource("./toppipe.png")).getImage();
bottomPipeImg = new ImageIcon(getClass().getResource("./bottompipe.png")).getImage();

// bird
bird = new Bird(birdImg);
pipes = new ArrayList<Pipe>();

// place pipes timer
placePipeTimer = new Timer(1500, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Code to be executed
placePipes();
}
});
placePipeTimer.start();

// game timer
gameLoop = new Timer(1000 / 60, this); // how long it takes to start timer, milliseconds gone between frames
gameLoop.start();
}

void placePipes() {
// (0-1) * pipeHeight/2.
// 0 -> -128 (pipeHeight/4)
// 1 -> -128 - 256 (pipeHeight/4 - pipeHeight/2) = -3/4 pipeHeight
int randomPipeY = (int) (pipeY - pipeHeight / 4 - Math.random() * (pipeHeight / 2));
int openingSpace = boardHeight / 4;

Pipe topPipe = new Pipe(topPipeImg);
topPipe.y = randomPipeY;
pipes.add(topPipe);

Pipe bottomPipe = new Pipe(bottomPipeImg);
bottomPipe.y = topPipe.y + pipeHeight + openingSpace;
pipes.add(bottomPipe);
}

public void paintComponent(Graphics g) {
super.paintComponent(g);
draw(g);
}

public void draw(Graphics g) {
// background
g.drawImage(backgroundImg, 0, 0, this.boardWidth, this.boardHeight, null);

// bird
g.drawImage(birdImg, bird.x, bird.y, bird.width, bird.height, null);

// pipes
for (int i = 0; i < pipes.size(); i++) {
Pipe pipe = pipes.get(i);
g.drawImage(pipe.img, pipe.x, pipe.y, pipe.width, pipe.height, null);
}

// score
g.setColor(Color.white);

g.setFont(new Font("Arial", Font.PLAIN, 32));
if (gameOver) {
g.drawString("Game Over: " + String.valueOf((int) score), 10, 35);
} else {
g.drawString(String.valueOf((int) score), 10, 35);
}

}

public void move() {
// bird
velocityY += gravity;
bird.y += velocityY;
bird.y = Math.max(bird.y, 0); // apply gravity to current bird.y, limit the bird.y to top of the canvas

// pipes
for (int i = 0; i < pipes.size(); i++) {
Pipe pipe = pipes.get(i);
pipe.x += velocityX;

if (!pipe.passed && bird.x > pipe.x + pipe.width) {
score += 0.5; // 0.5 because there are 2 pipes! so 0.5*2 = 1, 1 for each set of pipes
pipe.passed = true;
}

if (collision(bird, pipe)) {
gameOver = true;
}
}

if (bird.y > boardHeight) {
gameOver = true;
}
}

boolean collision(Bird a, Pipe b) {
return a.x < b.x + b.width && // a's top left corner doesn't reach b's top right corner
a.x + a.width > b.x && // a's top right corner passes b's top left corner
a.y < b.y + b.height && // a's top left corner doesn't reach b's bottom left corner
a.y + a.height > b.y; // a's bottom left corner passes b's top left corner
}

@Override
public void actionPerformed(ActionEvent e) { // called every x milliseconds by gameLoop timer
move();
repaint();
if (gameOver) {
placePipeTimer.stop();
gameLoop.stop();
}
}

@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
// System.out.println("JUMP!");
velocityY = -10;

if (gameOver) {
// restart game by resetting conditions
bird.y = birdY;
velocityY = 0;
pipes.clear();
gameOver = false;
score = 0;
gameLoop.start();
placePipeTimer.start();
}
}
}

// not needed
@Override
public void keyTyped(KeyEvent e) {
}

@Override
public void keyReleased(KeyEvent e) {
}
}
2 changes: 2 additions & 0 deletions Java/FlappyBird/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# FlappyBird
FlappyBird Game
Binary file added Java/FlappyBird/bottompipe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Java/FlappyBird/flappybird.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Java/FlappyBird/flappybirdbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Java/FlappyBird/toppipe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 27 additions & 28 deletions Javascript/Typing Speed Game/README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
# 🕹️ Typing Speed Game
🕹️ Typing Speed Game

A fast-paced browser game built with HTML, CSS, and JavaScript. Words fall from the top of the screen — type them before they hit the bottom! Designed to improve typing speed, accuracy, and reflexes.

---
🚀 Features

## 🚀 Features
🎮 Welcome screen with instructions and Start button

- 🎮 Welcome screen with instructions and Start button
- ⌨️ Real-time typing input and word matching
- 🧠 Score tracking and game-over detection
- ⏸️ Pause and resume functionality
- 🔄 Restart button to replay instantly
- 🧱 Responsive layout for desktop and mobile
⌨️ Real-time typing input and word matching

---
🧠 Score tracking and game-over detection

## 📦 Tech Stack
⏸️ Pause and resume functionality

- **HTML**: Structure and layout
- **CSS**: Styling and responsive design
- **JavaScript**: Game logic, animation, and input handling
🔄 Restart button to replay instantly

---
🧱 Responsive layout for desktop and mobile

## 📸 Gameplay Preview
⚡ Difficulty Settings: Easy, Medium, Hard

> Words fall from the top. Type them quickly to score points.
> If a word reaches the bottom, the game ends.
> You can pause and restart anytime.
Easy: slower words, +1 point per correct word

---
Medium: medium speed, +2 points per correct word

## 🛠️ How to Run
Hard: faster words, +3 points per correct word

1. Clone the repository:
```bash
git clone https://github.com/devmalik7/Game_Scripts.git
cd Javascript
cd "Typing Speed Game"
```
2. Run **index.md** in your browser.
📦 Tech Stack

HTML: Structure and layout

CSS: Styling and responsive design

JavaScript: Game logic, animation, input handling, and difficulty levels

📸 Gameplay Preview

Words fall from the top. Type them quickly to score points.
If a word reaches the bottom, the game ends.
You can pause, restart, and select difficulty anytime.

Select a difficulty (Easy, Medium, Hard) and start typing!
Loading
Loading