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

vue-phaser

v0.1.9

Published

Vue 2 wrapper for Phaser.

Downloads

25

Readme

vue-phaser

⚠️ This project is in active development! Expect breaking changes! ⚠️

vue-phaser is a Vue plugin for Phaser. You can use vue-phaser to quickly build browser games.

Installation

  1. npm install vue-phaser
  2. Register the plugin:
import VuePhaser from 'vue-phaser'
Vue.use(VuePhaser)

Setup

Here's a very basic vue-phaser setup:

<template>
  <!-- phaser-game wraps the game -->
  <phaser-game>
    <!-- phaser-scene wraps a single scene -->
    <!-- scene-key is required -->
    <!-- preload-queue is a list of files to load (example assumes you have a tilemap.png file available) -->
    <!-- auto-start starts the game on this scene -->
    <phaser-scene
      scene-key="game"
      :preload-queue="['tilemap.png']"
      auto-start
    >
      <!-- sprite-key is required -->
      <phaser-sprite sprite-key="tilemap" x="400" y="300" />
    </phaser-scene>
  </phaser-game>
</template>

Core Components

phaser-game

Wrapper for an entire Phaser game.

| Prop | Type | Default | Notes | | --------- | ---------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | | options | Object: Phaser.GameConfig | {} | Game options to pass directly to the Phaser.Game constructor. |

phaser-scene

Wrapper for a single Phaser scene.

| Prop | Type | Default | Notes | | -------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | | sceneKey | String | | Required | | init | Function | | Scene init function | | preload | Function | | Scene preload function | | create | Function | | Scene create function | | update | Function | | Scene update function | | autoStart | Boolean | false | Whether or not to start on this Scene. | | sceneData | Object | {} | Optional data to pass to scene. See docs. | | preloadQueue | Array | [] | Array of items to preload. See below. |

| Event | Arguments | Notes | | --------------- | --------------------------------------- | ------------------------------- | | load-progress | Number representing percentage complete | preload() load progress | | load-complete | Loader | All items in preload() loaded |

You can quickly load sprites in the preloadQueue with strings: ['example1.png', '/another/example2.png']

In this case, the filename minus the path and extension will be the sprite key (example1 and example2 above).

You can also pass objects to the queue (or mix and match strings and objects):

[{ url: '/more/examples/example3.png', key: 'my-key' }]

url and key properties are required, while type and options are allowed:

[{ 
  url: '/my/example4.png', 
  key: 'my-key-2', 
  type: 'spritesheet', 
  options: [{
      frameWidth: 32,
      frameHeight: 38,
      startFrame: 0,
      endFrame: 8
  }] 
}]

type is the method on load to run (see docs), while options is an array of options that will be spread and passed to the load method.

You can also pass a type string and args array for completely custom load method usage:

[{
  type: 'on',
  args: ['progress', console.log]
}]

type is still the method on load to run, while the args array is spread into the type method as its arguments. This is the equivalent to calling this.load.on('progress', console.log) in your scene's preload function.

phaser-sprite

TODO

License

NPL 5+

Contributing

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Customize configuration

See Configuration Reference.

Adding a New Component

  • Add the file in src/plugin/components.
  • Make sure that file extends src/plugin/components/common/base.js (see existing components for examples).
    • Also make sure to use any relevant mixins in the src/plugin/mixins folder - for example, anything movable like a Sprite or Container has several options already available.
  • Import the file into src/plugin/components/index.js.
  • Add the imported component to that file's export.