0.1.1695 • Published 9 years ago

dynamicgrid v0.1.1695

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

Dynamic Grid

This is a dynamic grid for gaming.

var Grid = require('dynamicgrid');
var grid = new Grid(w, h, segment); // Segment is {w : w, h : h}

var item = grid.createItem(110, 110); // Returns Item

// Update items position
item.update(x, y) // Defaults to current x and y

// Listen when items show up in segment
item.segment.on('update', cb);

// Listen to item changing segment
item.on('segment change', cb);

// Get plain object to pass to client 
item.plain();

// Destroy item
item.destroy();

// Check if x and y are within range of item
item.withinRange(x, y);

// Listen to segment group
item.listenToSegmentGroup(cb);

// Listen to destroyed items
grid.on('destroyed item', cb); // Gets passed item

// Listen to all segment changes in grid
grid.on('update', cb);

// With socket.io
io.emit('item', item.plain());

// Get all other items in segment 
item.getOtherItemsInSegment(true); // True passes as param returns all of the other items plain object
                                      // otherwise you get the full item

// Get items in surrounding segments
item.getItemsInSurroundingSegments(true); // True gets items in plain object
0.1.1695

9 years ago

0.1.1694

9 years ago

0.1.1693

10 years ago

0.1.1692

10 years ago

0.1.1691

10 years ago

0.1.1690

10 years ago

0.1.168

10 years ago

0.1.167

10 years ago

0.1.166

10 years ago

0.1.165

10 years ago

0.1.164

10 years ago

0.1.163

10 years ago

0.1.162

10 years ago

0.1.161

10 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago