Chapter 19. Snowball Fight!

In this chapter you’re going to create a player-versus-player mini-game called Snowball Fight (see FIGURE 19.1). The aim of the game is to hit your opponents with snowballs as many times as possible while avoiding being hit yourself or hitting players on your own team. In the game players can form opposing teams.


FIGURE 19.1 Snowball Fight

The game will be kept simple for the sake of providing example code, which you might want to adapt and extend to create your own mini-game.

The game will be started using a JavaScript function, and its duration and team structure will be passed as parameters. If no parameters are ...

Get A Beginner’s Guide to Writing Minecraft Plugins in JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.