Mini ARPG Design: Zelda in one Screen

advertisement
Creating Games Homework Mini ARPG Design: Zelda in one Screen Due April 9 at 8:30pm th
Challenge: Working by yourself1, create a design and technology plan for a small Action
RPG video game with at least three mechanics, which you will implement the following
week in lab.
The Legend of Zelda created the “Action RPG” genre, which today includes the Skylanders and Diablo franchises among many others. It is loosely defined by a set of mechanics that overlap other genres: •
•
•
•
real-­‐time quest-­‐based framework inventory top-­‐down perspective •
•
•
health (and possibly other) stats open world with some areas initially locked one ultimate goal Note that there is no actual “role” playing in an ARPG. Working from the codeheart.js “Knight” sample program, write a one-­‐page proposal for a simple ARPG and a combined summary of mechanics and description of how you will implement them. Your implementation plan should give explicit details. Keep the scope of the project in mind and avoid over-­‐reaching—if you have great ideas, then nobody will stop you from implementing them as well, but don’t commit to them now. The primary goal of this assignment and the follow-­‐up implementation next week is to build your programming and software design skills. Most ARPG mechanics are a variant of either lock & key or combat modifiers. For example, a treasure chest is a “lock” restricts access to an upgrade until the literal key is obtained, and a boat (or perhaps, fish medallion) is a “key” that restricts access to locations across a “lock” of water. An example of the level of detail to seek in your implementation plan will be presented in lab this afternoon. It is always a good idea to include diagrams, equations, nested lists, and actual code snippets where that will clarify what you are communicating. You may introduce graphical changes to the game, but plan to do so in a cursory fashion (i.e., a big area of blue instead of carefully painted and animated water) until you’ve polished your mechanics implementation. Visual art is not a focus of this assignment. Bring two copies of your assignment on Tuesday. One is for me to evaluate and the other is for you to use when working in lab. 1 I strongly encourage you to consult with me and the TAs; “yourself” means no 3rd parties or other students Sample ARPG Mechanics Design and Technology Plan Note that, in line with the goals of the associated assignments, this has no mechanics analysis and only a cursory explanation of the mechanics themselves. You may include the mechanics from this example in your game, but they do not count towards the required three mechanics. I add two mechanics to the game: an Inventory that can be extended to support lots of mechanics, and health Potions. INVENTORY There is a single Object named “player” declared at the top level. It has fields for “position” (itself an object with “x” and “y” Number fields), “health” (a Number), “inventory” (an Array) …: • player Object o position Object § x Number § y Number o inventory Array o … The inventory can be initialized using: player.inventory = makeArray(0); or player.inventory = [ ]; or by putting elements in it: player.inventory = [ “sword” ]; or player.inventory = makeArray(0); insertBack(player.inventory, “sword”); I find the [“sword”] syntax is the most convenient. When the player character picks up an item in the world, the game adds the name of that item (a String) to the back of the inventory using the insertAt function: insertAt(player.inventory, “key”); The game can test whether the player has a particular item in the inventory using the indexOf function, which returns -­‐1 when the object is not found: if ( indexOf(player.inventory, “key”) != -­‐1) { // we have the key! … Objects can be removed from the inventory using the removeAt function combined with the indexOf function: removeAt(player.inventory, indexOf(player.inventory, “key”)); The game displays the inventory by simply printing the elements of the array on screen using the fillText function: var i = 0; while (i < length(player.inventory)) { fillText(player.inventory[i], 100, i * 100, makeColor(0, 0, 0),“50px Serif”); i = i + 1; } POTIONS The player character starts with three potions in the inventory: player.inventory = [“potion”, “potion”, “potion”]; Pressing the “P” key uses a potion, consuming it and playing a sound to give auditory feedback: function onKeyStart(key) { … if (key == asciiCode(“P”)) { var i = indexOf(player.inventory, “potion”); if (i >= 0) { // Add to health, but don’t go over 5 player.health = min(player.health + 1, 5); // Remove the potion removeAt(player.inventory, i); // Play a nice sound playSound(POTION_SOUND); } else { // Play a not-­‐nice sound playSound(BAD_PLAYER); // Show an ugly message on a popup alert(“You don’t have a potion to drink!”); } } Note that my change does not make the hearts at the top of the screen change. Another code modification is needed to actually display the health (tip: maybe a “while” loop should draw the hearts in onTick()) Bring two copies of your assignment on Tuesday. One is for me to evaluate and the other is for you to use when working in lab. 
Download