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

@phasereditor2d/scripts-random

v1.0.2

Published

Audio scripts for Phaser Editor 2D.

Downloads

16

Readme

Phaser Editor 2D Random Scripts (library)

This project contains Phaser Editor 2D scripts for configuring random actions.

These script nodes are very basic and may fit on any Phaser Editor 2D project.

The scripts are coded in TypeScript with ES modules.

Installing (NPM)

This package depends on the following packages:

  • @phasereditor2d/scripts-core

To install this in your game you have to install dependencies too:

npm install @phasereditor2d/scripts-core
npm install @phasereditor2d/scripts-random

Also, you should add this package to the phasereditor2d.config.json file in your project, in the scripts section:

{
    "scripts": [
        "@phasereditor2d/scripts-core",
        "@phasereditor2d/scripts-random"
    ]
}

Installing (vanilla JavaScript)

  • Get the files in the browser folder and copy them into your JavaScript project. It includes Phaser Editor 2D files, JavaScript files, and TypeScript type definitions.
  • Add a script tag to the index.html file to load the lib/phasereditor2d_scripts_random.js file.

Summary

This library provides a few actions for using random values in your game. You can configure the domain of the random values by using the configuration components.

As a reminder, an action is executed by an event script or another action.

The actions:

  • Set Random X Action - Set a random value to the object's X.
  • Set Random Y Action - Set a random value to the object's X.

The configuration components:

  • Random Between Config - To select an integer random value between two numbers.
  • Random Multiple Config - To select an integer random multiple between two numbers.
  • Random In Array Config - To pick a random value in an array of options.

Set Random X Action

Class: SetRandomXActionScript

This action sets a random X value to the game object. It requires that you add to this node one of the random configuration components.

It allows

Set Random Y Action

Class: SetRandomYActionScript

This action sets a random Y value to the game object. It requires that you add to this node one of the random configuration components.

Random Between Config

This user component contains the configuration for generating a random integer values between the given parameters Min and Max.

Random Multiple Config

This user component contains the configuration for generating random integer values between the given parameters Min and Max, but it is also a multiple of the Multiple parameter.

Eg., with a multiple of 10, the possible values between 10 and 30 are 10, 20, and 30.

Random In Array Config

This user component contains the parameters for picking a random number from an array of options. You can write the array in the Options parameters, following a JSON array format. Like this: [10, 34, 2, 89, 20].