banada / aframe-spawnpoint-component

Spawn A-Frame entities from a point
MIT License
4 stars 3 forks source link

aframe-spawnpoint-component

Version License

DEMO

Spawn A-Frame entities from a point.

For A-Frame.

API

Property Description Default Value
size pool size 10
pattern random, even random
origin Origin of the spawn pattern {x: 0, y: 0, z: 0}
radius Radius around the origin 10
enableY Enable random on y-axis false
rate How often to spawn, in milliseconds. If 0, spawn all at once. 0

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-spawnpoint-component/dist/aframe-spawnpoint-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity spawnpoint__enemy="size: 20; radius: 100;"></a-entity>
    <a-assets>
        <a-mixin id="enemy" geometry="primitive: box;" material="color: red;"></a-mixin>
    </a-assets>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-spawnpoint-component

Then require and use.

require('aframe');
require('aframe-spawnpoint-component');