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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rexysaur/fruity

v1.0.2

Published

Fruity 2D is a game engine written in javascript, used for web-based games. It has many features, such as:

Readme

Fruity 2D

Fruity 2D is a game engine written in javascript, used for web-based games. It has many features, such as:

  1. Box Colliders
  2. Sprite Classes
  3. Support for Mass-Generation

Installation

To install Fruity 2D you can use npm

npm install @rexysaur/fruity

or use github to clone a barebone project

git clone https://github.com/darkboat/Fruity/

Usage

Game

Initiate the Game

Initiating the game is very simple using fruity. All you have to do is create an instance of the Game class.

import Fruity from "../Fruity"; // Import Fruity

const canvas = document.querySelector("canvas"); // Get the canvas reference

// You have to pass the canvas as a parameter so the engine can draw onto the canvas
const game = new Fruity.Game(canvas); // Create an instance and store it into a variable

KeyPressEvents

Keypress events can be chained and are very efficient. You can add a key event and a callback function which will be run when the event is fired

game.onKeyPress("f", doSomething()).onKeyPress("g", doSomethingElse());

Sprites

Creating the Sprite

Creating a Sprite is simple using fruity, It is similar to initiating the game in the sense that you have to create an instance of a class. An example of creating a sprite

// The parameters you pass in are as follows:
// 1. gameInstance
// 2. the starting x coordinate of the sprite
// 3. the starting y coordinate of the sprite
// 4. the starting width of the sprite
// 5. the starting height of the sprite
const sprite = new Fruity.Sprite(gameInstance, x, y, width, height);

// p.s. The reason I described all of the parameters as starting is because you can change them
// and the game loop will re-draw them with the new changes

Moving the Sprite

Moving a sprite is very easy to do and it is quite self-explanatory aswell. All you have to do is get a reference to the sprite and use the movement functions to change its position

// The movement functions take one parameter
// 1. The pixel change amount (how much the sprite will move by when invoked)
sprite.moveRight(pixelChangeAmount);

You can also use the setPosition() function to move it to a specific area on the canvas

// The setPosition function takes two parameters
// 1. x coordinate that it will be moved to
// 2. y coordinate that it will be moved to
sprite.setPosition(x, y); // Moves the sprite to the location

Box-Colliders

Appending a Box-Collider to a sprite

You can add physics and collision to a sprite by appending a Box-Collider to it. This can be done by creating an instance of a Box-Collider and passing in a Sprite reference as a parameter

const spriteCollider = new Fruity.BoxCollider(spriteReference); // Create a Box-Collider and append it to a Sprite

You will have to update the position of the Box-Collider so it stays on-top of the Sprite like so,

game.loop(() => {
  spriteCollider.update();
});