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.

Image

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.