Rot.js tutorial

From RogueBasin
Revision as of 13:56, 12 December 2012 by Ondras (talk | contribs)
Jump to navigation Jump to search

Ananas aus Caracas: a sample game built using rot.js

Welcome to this tutorial! We are going to create a very simple roguelike game, playable in any modern browser. To achieve this, our language of choice would be JavaScript; to simplify our work, we are going to use the rot.js toolkit.

Requirements

  • Basic JavaScript knowledge
  • Modern web browser (Firefox, Chrome, Opera, Safari, IE9+)

Game setting

The tutorial consists of three chapters, which gradually add more and more functionality. The game itself is pretty simple: motivated by this video, a player needs to find an ananas hidden within several boxes in an underground dungeon. It is necessary to find the ananas before Pedro (the ananas owner) finds and punishes you for sneaking into his warehouse.

Tutorial contents

NOTE: Working code samples from this tutorial are hosted at jsfiddle.net and use rot.js from GitHub. Please note that GitHub is not a CDN; you should use your own servers to host all the necessary files.

  • Part 1: Basics, map
    Create the basic data structures, initialize the output area, generate and draw the map
  • Part 3: Interaction, Pedro
    Let the player open boxes (to make the game winnable); implement Pedro and his pathfinding (to make the game losable)