Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
22 changes: 20 additions & 2 deletions INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Welcome to Game_Scripts — an open-source collection of mini games!
This index automatically tracks all games across different programming languages.
Last updated: Wed Oct 15 20:32:09 UTC 2025
Last updated: Mon Oct 20 04:33:38 UTC 2025

Tracked 21 games across 3 languages.
Tracked 27 games across 3 languages.

## 📚 Table of Contents
- [Java](#java-games)
Expand All @@ -16,9 +16,15 @@ Tracked 21 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

### 🎯 [LogGame](./Java/LogGame/)
A simple Java Swing application that lets users create and manage a live log through an interactive GUI.

### 🎯 [MemoryCardGame(GUI)](./Java/MemoryCardGame(GUI)/)
🎮 Memory Card Matching Game (GUI)

Expand All @@ -28,6 +34,9 @@ A fun game built with core programming concepts
### 🎯 [PongGameGUI](./Java/PongGameGUI/)
🎮 Pong Game GUI

### 🎯 [SnakeGame](./Java/SnakeGame/)
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.

### 🎯 [TicTacToe](./Java/TicTacToe/)
The Number Guessing Game GUI is a simple and interactive game built using Java Swing.

Expand All @@ -48,6 +57,12 @@ A fun game built with core programming concepts
### 🎯 [Stopwatch App](./Javascript/Stopwatch App/)
A simple yet elegant web-based stopwatch application with start, stop, and reset functionality.

### 🎯 [Typing Speed Game](./Javascript/Typing Speed Game/)
🕹️ Typing Speed Game

### 🎯 [Weather Site](./Javascript/Weather Site/)
A fun game built with core programming concepts

## Python Games

### 🎯 [Brick_Breaker](./Python/Brick_Breaker/)
Expand All @@ -65,6 +80,9 @@ A fun game built with core programming concepts
### 🎯 [Snake_Game](./Python/Snake_Game/)
- Language: Python

### 🎯 [snake_game_pygame](./Python/snake_game_pygame/)
🐍 Snake Game – Pygame Edition

### 🎯 [Snake_Water_Gun](./Python/Snake_Water_Gun/)
By now we have 2 numbers (variables), you and computer

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