Skip to content

Instantly share code, notes, and snippets.

@itsjoekent
Created August 24, 2015 18:24
Show Gist options
  • Save itsjoekent/07faf13557b35a67c1d6 to your computer and use it in GitHub Desktop.
Save itsjoekent/07faf13557b35a67c1d6 to your computer and use it in GitHub Desktop.
if(monster.x + monsterSpeed == data.x || monster.x - monsterSpeed == data.x || monster.x == data.x) {
if(monster.y + monsterSpeed == data.y || monster.y - monsterSpeed == data.y || monster.y == data.y) {
if(data.x > wallWidth && data.x < mapWidth - wallWidth) {
if(data.y > wallHeight && data.y < mapHeight - wallHeight) {
monster.x = data.x;
monster.y = data.y;
monster.direction = data.direction;
socket.broadcast.emit('update-pos', monster);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment