Giter Site home page Giter Site logo

robbles / voxel-rescue Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 10.0 722 KB

voxel.js module for automatically teleporting the player back to a known location if they enter a certain region of the world (e.g. fall off the map)

Home Page: robbles.github.com/voxel-rescue

JavaScript 65.07% HTML 34.93%

voxel-rescue's Introduction

voxel-rescue

Automatically teleport the player back to a known location if they enter a certain region of the world (e.g. fall off the map)

NOTE: this module is based pretty heavily on maxogden/voxel-highlight.

npm install voxel-rescue

example

var rescue = require('voxel-rescue')
rescue(game)

rescue(gameInstance, optionalOptions)

options can be:

{
  frequency:  // how often in milliseconds to check player position, default is 500.
  position:   // where to teleport the player when they enter the danger zone, default is game.startingPosition.
  teleport:   // if false, do not teleport the player automatically, only emit a 'rescue' event. default is true.
  dangerZone: // area to rescue the player from. default is:
  {
    lower: {x: -Infinity, y: -Infinity, z: -Infinity},
    upper: {x: Infinity, y: -100, z: Infinity}
  }
}

rescue.on('rescue', function(position) {})

gets called when player is rescued with the position they were at when rescued.

Get the demo running on your machine

The first time you set up, you should install the required npm packages:

cd voxel-rescue
npm install
npm install browserify -g

Then run the start script (which you'll need to do every time you want to run the demo):

npm start

Then point your browser to http://localhost:8080 and have fun!

If you get stuck then look at the readme for voxel-hello-world

license

BSD

voxel-rescue's People

Contributors

caseyyee avatar jb55 avatar robbles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.