mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-08-07 11:17:06 +08:00
Progress: Documentation
This commit is contained in:
@@ -90,15 +90,14 @@ GarageServerIO.addInput(myInput);
|
||||
```
|
||||
**3.** Inside render loop, extract player and entity states
|
||||
```js
|
||||
GarageServerIO.getStates(function (playerStates, entityStates) {
|
||||
var playerStates = GarageServerIO.getPlayerStates(),
|
||||
entityStates = GarageServerIO.getEntityStates();
|
||||
playerStates.forEach(function (player) {
|
||||
ctxCanvas.fillRect(player.state.x, 0, 5, 5);
|
||||
ctxCanvas.fillRect(player.state.x, player.state.y, playerSize, playerSize);
|
||||
});
|
||||
|
||||
entityStates.forEach(function (entity) {
|
||||
ctxCanvas.fillRect(entity.state.x, 0, 5, 5);
|
||||
ctxCanvas.fillRect(entity.state.x, entity.state.y, entitySize, entitySize);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Reference in New Issue
Block a user