npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cds.id/fruits-ninja

v1.0.1

Published

A Fruit Ninja game component for React applications

Downloads

127

Readme

Fruit Ninja Clone

A modern web-based clone of the classic Fruit Ninja game built with React, TypeScript, and Canvas.

🎮 Demo

[Add your demo link here]

Game Screenshot

✨ Features

  • 🎯 Smooth fruit slicing mechanics
  • 🍎 Multiple fruit types with different point values
  • 💫 Dynamic difficulty scaling
  • 🌟 Particle effects and slice trails
  • 📱 Mobile and desktop support
  • 🎮 Lives system
  • 📊 Score tracking
  • 🔄 Progressive gameplay

🛠️ Tech Stack

  • React 18
  • TypeScript
  • Tailwind CSS
  • Vite
  • HTML5 Canvas

🚀 Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/fruit-ninja.git
  1. Navigate to the project directory:
cd fruit-ninja
  1. Install dependencies:
npm install
# or
yarn
  1. Start the development server:
npm run dev
# or
yarn dev
  1. Open http://localhost:5173 in your browser.

🎮 How to Play

  1. Click "Start Game" to begin
  2. Slice fruits by swiping across them with your mouse or finger
  3. Each fruit gives different points when sliced
  4. Miss 3 fruits and the game ends
  5. Game gets progressively harder every 30 seconds
  6. Try to achieve the highest score!

🏗️ Project Structure

fruit-ninja/
├── src/
│   ├── assets/
│   │   └── fruits/          # Fruit images
│   ├── components/          # React components
│   ├── hooks/              # Custom React hooks
│   ├── config/             # Game configuration
│   └── types/              # TypeScript types

🎯 Game Mechanics

  • Difficulty Scaling: Game difficulty increases every 30 seconds
  • Lives System: Player has 3 lives, loses one for each missed fruit
  • Scoring: Different fruits give different points
  • Fruit Physics: Realistic throwing and slicing mechanics
  • Visual Effects: Slice trails and particle effects

🔧 Configuration

Key game parameters can be adjusted in the following files:

// Game.tsx
const FRUIT_SIZE = 69
const MAX_FRUITS = 3
const SPAWN_INTERVAL = 2000
const SPAWN_VARIATION = 1000

// useFruits.ts
const GRAVITY = 0.3
const INITIAL_VELOCITY_Y = -20

🖼️ Assets

The game uses the following fruit assets:

  • Apple
  • Banana
  • Peach
  • Watermelon (Sandia)

Each fruit has multiple states:

  • -w: Whole fruit
  • -l: Left slice
  • -r: Right slice
  • -s: Splat effect
  • -j: Juice particle

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Original Fruit Ninja game by Halfbrick Studios
  • [List any other resources or inspirations]