HTML and CSS Reference
In-Depth Information
Figure 19-17. Here, you can see that you can now move the player around the map
Extending Your Engine
At this point, you have a fully functional engine for a rogue-like game written in TypeScript. There are several places to
which you may want to extend the functionality of this engine. Following are some of the top things you might do next
to explore further how TypeScript works.
Adding Enemies and Treasure
It's relatively easy to add additional items to the game. Because the basic foundation is there, you need only follow
these steps:
1.
Add a method to the map class that allows you to find empty tiles easily.
2.
Build a helper class to populate the dungeon with items and monsters.
3.
Move the player position into the map populater class, and have it store the ID, tile type,
and point for each object in the map.
4.
Add new colors, based on each item; also, perhaps use an “m” for monster (or “m1,” “m2,”
and so on for different types of monsters) and an “x” for treasure chests.
Modify the render's tileColor to display each new tile type with its own unique color.
5.
6.
In your game's render code, simply loop through the array of game objects stored in
the populator manager, and have them draw to the map, just as you did with the player
originally.
7.
In your move code, you can add more values to the switch statement to call methods that
handle picking up treasure or attacking monsters.
 
Search WWH ::




Custom Search