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

@roudanio/cube-match

v0.3.3

Published

A cube matching game made using vite and threejs. You can select unobstructed cubes to free them from the bundle, The goal is to free all the cubes!

Downloads

5,218

Readme

cube-match

A cube matching game made using vite and threejs. You can select unobstructed cubes to free them from the bundle, The goal is to free all the cubes!

Build

Removing Dev Styles

Some styles are included to make the test version look good, while others are essential to the functionality of the game.

The non essential styles are imported in style.css as @import dev.css; feel free to remove those entirely

Customizing HTML

The html that is used in production is kept at core/index.html

Any change to it will reflect in the final build.

Meanwhile the index.html at root is the dev version, Changes to it will only reflect in dev mode.

Building the game

The game can be built using yarn build

All the files will be built in the new dist folder

Usage

// example
import CubeMatch from 'https://unpkg.com/@roudanio/cube-match@latest/dist/cube-match.js';

// fist parameter is the element selector
// second parameter is a config object
CubeMatch.init('.cube_match_game_container', {
  root: 'https://unpkg.com/@roudanio/cube-match@latest/dist/',
});

The default config object is like this

{
  root: location.origin,
  lcPrefix: 'mb-', // default local storage key prefix
  i18n: i18nDefault, // default i18n setting is in i18n.json
  cubeFlightSpeed: 1,
  minDragDistance: 5, // when pointer moving distance is over 5px,it will be considered as a drag, not a click
  comboExpireTime: 2000, // unit: ms, within this time, count as a combo
  allowedCubes: {
    1: [[1, 1, 1]],
    2: [
      [1, 1, 2],
      [2, 1, 1],
    ],
    3: [
      [2, 1, 2],
      [4, 3, 2],
      [2, 2, 1],
      [1, 2, 2],
      [1, 2, 1],
    ],
    5: [[4, 2, 4]],
  },
  levelSizes: {
    1: [2, 2, 2],
    2: [2, 3, 2],
    5: [5, 5, 5],
    12: [10, 12, 8],
    20: [12, 8, 10],
    100: [20, 20, 20],
  },
}

The default i18n is put in file ./src/i18n.json. The content is like this:

{
  "name": "Block Dash",
  "availableLevels": "Available Levels",
  "reset": "Reset",
  "cancel": "Cancel",
  "ok": "OK",
  "quit": "Quit!",
  "quitDialogTitle": "You have made some progress of Lv %LEVEL%, do you really want to quit?",
  "soundOn": "Sound: ON",
  "soundOff": "Sound: OFF",
  "confirmReset": "Do you want to reset all the game data and start from scratch?",
  "toggleResetCode": "Protect your progress with a reset code",
  "enterResetCode": "Enter your reset code to reset instantly",
  "enterCodePlaceholder": "Enter your code...",
  "forgotResetCodeTip": "Forgot your code? Reset the game and wait for 10 minutes. :)",
  "createResetCode": "Create a reset code",
  "create": "Create",
  "createCodePlaceholder": "Start typing...",
  "createCodeTip": "Without the correct code, resetting will take 10 minutes and you must keep this window open.",
  "createCodeWarning": "WARNING: Do NOT use any passwords or personal info for the reset code. It's stored in your browser without encryption.",
  "back": "Back",
  "progress": "Progress",
  "level": "Level",
  "start": "Start",
  "play": "Play",
  "best": "Best",
  "current": "Current",
  "time": "Time",
  "bestTime": "Best Time",
  "yourScore": "Your Score:",
  "score": "Score",
  "bestScore": "Best Score",
  "speedrun": "Speedrun",
  "accuracy": "Accuracy",
  "levelBreakdown": "Level Breakdown",
  "tweet": "Tweet",
  "facebook": "Facebook",
  "copyLink": "Copy Link",
  "share": "Share",
  "shareText": "I have scored %SCORE% in Block Dash. I have completed %LVL% levels in %TIME% with accuracy of %ACC%.",
  "masterDialogTitle": "Congratulations on masterinf all the levels of Block Dash!",
  "masterDialogText": "Ready for another challenge? Replay earlier levels to improve your score and set new personal records!"
}