Appendix A: Game Design Documentation

While you will learn many technical and practical aspects of game development as you work through the example projects in this book, it is equally important to have a solid foundation in the theoretical aspects of game design. The first effort to create a framework for these concepts is discussed in a paper published by Robin Hunicke, Marc LeBlanc, and Robert Zubek in 2004. 1 There, they proposed the Mechanics-Dynamics-Aesthetics (MDA) framework, which provides a useful way to categorize the components of a game. They defined Mechanics as the formal rules of the game, expressed at the level of data structures and algorithms, Dynamics as the interaction between the player and the game mechanics while the game is in progress, and Aesthetics as the emotional responses experienced by the player as they interact with the game. Since then, other frameworks have been proposed, each of which provides a different way of analyzing games. A popular example is Jesse Schell’s Elemental Tetrad , 2 which consists of Mechanics, Story, Aesthetics, and Technology (where aesthetics is defined more broadly than in the original MDA framework) . Frameworks such as these are a valuable tool to help people consistently and fully analyze games. Players can use frameworks to better understand and express what they enjoy about particular games. Developers can use the formal structure to help them create a more cohesive design and to organize and document the development process; explaining how to write such documentation is the goal of this appendix.
A game design document (GDD) serves as the blueprint or master plan for creating a game. It describes the overall vision of a game, as well as the details (often based on a game design framework such as MDA) . Practical aspects are also included, such as a schedule that lists when certain features will be completed, a list of team members and responsibilities, and plans for testing and releasing the game. A GDD can provide clarity and focus while serving as a guide and a reference to the person or people working on the game. To be most effective, the GDD should be as complete as possible before the development process begins. Depending on the flexibility of the developers , a certain amount of modification may be permitted over the course of development, and various adjustments may need to be made after collecting feedback from gameplay testing.
There is no one standard format for game design documents; an internet search will provide many templates for a variety of development scenarios. GDD templates often contain a bulleted list of topics or questions for your consideration (when applicable). In this chapter, we present a similar list of questions for you to ponder as you design your own games, followed by a sample response for a more polished version of the Space Rocks game presented earlier in this book. The scope of these questions is particularly good for individuals or small teams working on game development projects. By recording detailed responses to the queries that follow, you will effectively create your own game design document to help guide you through the development process.

Game Design Documentation Questions

  1. 1.
    Overall Vision
    1. a.
      Write a short paragraph (3–6 sentences) explaining your game. (This is sometimes called the elevator pitch : a short summary used to quickly and simply describe an idea or product during a 30-second elevator ride.)
       
    2. b.
      How would you describe the genre(s)? Is it single-player or multi-player (and, if the latter, cooperative or competitive)?
       
    3. c.
      What is the target audience? Include demographics (the age, interests, and game experience of potential players), the game platform (desktop, console, or smartphone), and any special equipment required (such as gamepads).
       
    4. d.
      Why will people want to play this game? What features distinguish this game from similar titles? What is the hook that will get people interested at first, how will the game keep people interested, and what makes it fun?
       
     
  2. 2.
    Mechanics: the rules of the game world. (Note that the questions that follow are phrased in terms of the game’s main character, as distinguished from the player, since the player is the focus of the section on dynamics. However, if no such character exists, the player can be considered as the character.)
    1. a.
      What are the character’s goals? These may be divided into short-term, medium-term, and long-term goals.
       
    2. b.
      What abilities does the character have? This should include any action the character is capable of performing, such as moving, attacking, defending, collecting items, interacting with the environment, and so forth. Describe the abilities or actions in detail; for example, how high can the character jump? Can the character both walk and run?
       
    3. c.
      What obstacles or difficulties will the character face? Some obstacles are active (such as enemies, projectiles, or traps) and should be described in detail (how they affect the player, their location, movement patterns, and so forth). Other obstacles are passive (such as doors that need to be unlocked, mazes that need to be navigated, puzzles that need to be solved, or time limits that need to be to beat). How can the character overcome these obstacles (items, weapons, spells, quick reflexes)?
       
    4. d.
      What items can the character obtain? What are their effects, where are they obtained, and how frequently do they appear?
       
    5. e.
      What resources must be managed (such as health, money, energy, and experience)? How are these resources obtained and used? Are they limited?
       
    6. f.
      Describe the game-world environment. How large is the world (relative to the screen)? Are there multiple rooms or regions? Is the gameplay linear or open? In other words, is there a strictly linear progression of levels or tasks to complete, or can the character select levels, explore the world, and complete quests at will?
       
     
  3. 3.
    Dynamics: the interaction between the player and the game mechanics.
    1. a.
      What hardware is required by the game (keyboard, mouse, speakers, gamepad, touchscreen)? Which keys/buttons are used, and what are their effects? How is the player informed of the control scheme (a separate manual document, game menus, tutorials, or in-game signs)?
       
    2. b.
      What type of proficiency will the player need to develop to become proficient at the game? Are there any complex actions that can be created from combinations of basic game mechanics? Do the game mechanics or game-world environment directly or indirectly encourage the player to develop or discourage any particular play strategies? Does the player’s performance affect the gameplay mechanics (as in feedback loops)?
       
    3. c.
      What gameplay data is displayed during the game (such as points, health, items collected, time remaining)? Where is this information displayed on the screen? How is the information conveyed (text, icons, charts, status bars)?
       
    4. d.
      What menus, screens, or overlays will there be (title screen, help/instructions, credits, game over)? How does the player switch between screens , and which screens can be accessed from each other?
       
    5. e.
      How does the player interact with the game at the software level (pause, quit, restart, control volume)?
       
     
  4. 4.
    Aesthetics: the visual, audio, narrative, and psychological aspects of the game; these are the elements that most directly affect the player’s experience.
    1. a.
      Describe the style and feel of the game. Does the game take place in a world that is rural, technological, or magical? Does the game world feel cluttered or sparse, ordered or chaotic, geometric or organic? Is the mood lighthearted or serious? Is the pace relaxing or frenetic? All the aesthetic elements discussed here should work together and contribute to create a coherent and cohesive theme.
       
    2. b.
      Does the game use pixel art, line art, or realistic graphics? Are the colors bright or dark, varied or monochromatic, shiny or dull? Will there be value-based or image-based animations? Are there any special effects? Create a list of graphics you will need.
       
    3. c.
      What style of background music or ambient sounds will the game use? What sound effects will be used for character actions, or for interactions with enemies, objects, and the environment? Will there be sound effects corresponding to interactions with the user interface? List all the music and sounds you will need.
       
    4. d.
      What is the relevant backstory for the game? What is the character’s motivation for pursuing their goal? Will there be a plot or storyline that unfolds as the player progresses through the game?
       
    5. e.
      What emotional state(s) does the game try to provoke: happiness, excitement, calm, surprise, pride, sadness, tension, fear, frustration?
       
    6. f.
      What makes the game “fun”? Some players may enjoy the graphics, music, story, or emotions evoked by the game. Other features players might enjoy include
      1. i.
        fantasy (simulating experiences one doesn’t have in real life)
         
      2. ii.
        role-playing (identifying with a character)
         
      3. iii.
        competition (against other players or against records previously set by oneself)
         
      4. iv.
        cooperation (working with others toward a common goal)
         
      5. v.
        compassion (providing assistance or rescuing others)
         
      6. vi.
        discovery (finding objects or exploring a world)
         
      7. vii.
        overcoming challenges (such as defeating enemies or solving puzzles)
         
      8. viii.
        collection (including game items or badges/trophies for achievements)
         
      9. ix.
        social aspects (both within the game and the communities that form around the game).
         
       
     
  5. 5.
    Development
    1. a.
      If working with a group: list the team members and their roles (game designer, programmer, illustrator, animator, composer, sound editor, writer, manager, etc.), responsibilities, and skills.
       
    2. b.
      What equipment will you need for this project? Include both hardware and software that will be needed for content creation (graphics and audio), game development, and playtesting.
       
    3. c.
      What are the tasks that need to be accomplished to create this game? Estimate the time required for each task and note the estimated completion date, the team member responsible, and the priority of each feature (in case some features need to be eliminated due to time constraints or unexpected circumstances).
       
    4. d.
      What points in the development process are suitable for playtesting? How will you find people to playtest your game? What specific kinds of feedback are you interested in gathering? (For example, you could ask how clear the goals are, how easy or intuitive the controls are, how balanced the difficulty level is, and which parts of the game were most or least enjoyable.) Finally, how will you collect this information (such as a questionnaire or a brief discussion)?
       
    5. e.
      What are your plans for dissemination? Do you have plans to promote this game through social media, forum postings, gameplay videos, or advertisements?
       
     

Case Study: Space Rocks

This section features a sample set of responses to the game design documentation questions for a significantly more complete version of the Space Rocks game from Chapter 4 .
  1. 1.
    Overall Vision
    1. a.
      Space Rocks is a space-themed shoot-em-up game. The player controls a spaceship whose goal is to shoot lasers and destroy rocks that are flying around the screen, earning points along the way. Once each screen is cleared, the player earns bonus points depending on the time needed to complete the level, then moves onto a similar but slightly more difficult level. The ultimate goal is to attain the highest score possible.
       
    2. b.
      This is a single-player action game.
       
    3. c.
      This game is appropriate for all ages and is simple enough to be enjoyed by casual gamers. The target platform is desktop computers, and the game is controlled with the keyboard; gamepad controller support is also possible (only the directional pad and buttons are needed).
       
    4. d.
      This game is fast-paced, and average gameplay sessions will be only a few minutes long, encouraging players to try repeatedly to achieve the highest score they can. A variety of background images and special effects will be used for visual interest.
       
     
  2. 2.
    Mechanics
    1. a.
      The short-term goal is to avoid being hit by rocks in order to survive. The medium-term goals are to destroy the rocks flying around the screen and to do so quickly to maximize the score for that level. The long-term goal is to earn the highest score possible.
       
    2. b.
      Abilities:
      1. i.
        The spaceship moves by rotating left and right and accelerating forward in the direction it is facing. There is no deceleration; to stop or reverse direction, the spaceship must rotate and accelerate in the opposite direction.
         
      2. ii.
        The spaceship is able to shoot lasers (one per second), which travel in a straight line for one second, then fade out and disappear from the game if they haven’t collided with a rock. If a laser hits a rock, the rock and the laser are both destroyed.
         
      3. iii.
        The spaceship is surrounded by a shield. If the spaceship is hit by a rock while the shields are active, the rock is destroyed and the shields lose power. After shield power is reduced to 0, the shields disappear, and being hit by a rock destroys the spaceship and ends the game.
         
      4. iv.
        The spaceship also has the ability to instantly, randomly teleport to a new location on the screen. While this can be used for quick escapes from an imminent collision, there is the possibility of teleporting onto a rock, and so the player may choose to use this ability sparingly (only in case of imminent destruction) or perhaps not at all.
         
       
    3. c.
      The only active obstacles are the rocks that the spaceship must avoid and shoot; they have random initial directions and speeds within a given range. The time required to finish each screen affects the player’s score, but does not have a direct effect on the spaceship in any way. In each subsequent level, the challenge increases by one or more of the following factors: increasing the number of rocks, increasing the overall speed of the rocks, or decreasing the size of the rocks.
       
    4. d.
      When an asteroid is destroyed, there is a 10 percent chance that it will leave behind a small energy capsule, which is an item that can be collected by the player to recharge the shields to 100 percent. Similarly, there is a 10 percent chance that sparkling golden fragments will be left behind, which awards more points to the player. Each item vanishes four seconds after appearing, so the player must be quick if they wish to collect them. (Thus, there is a 20 percent chance overall that a special item will appear, which will be an energy capsule half the time, and gold half the time.)
       
    5. e.
      The number of lasers the player can fire are unlimited; the only resource the player needs to be aware of is the remaining shield power, which can be recharged by collecting energy capsule items.
       
    6. f.
      The game world is a single screen, but features wraparound: after an object (spaceship, rock, or laser) moves past one edge of the screen, it reappears on the opposite edge. This design makes the game world feel larger (by not having a boundary) while still allowing the player to see all objects in the game world at the same time.
       
     
  3. 3.
    Dynamics
    1. a.
      To play this game, a desktop computer is required. Navigating the menus requires a mouse to click on various buttons. The spaceship is controlled entirely by the keyboard: left/right arrow keys rotate the ship, up arrow activates the thrusters and accelerates the ship forward, spacebar shoots lasers, and the X key teleports the spaceship to a random location. Gamepad controls are provided but are optional: directional pad left/right rotates the ship, and three buttons (such as A, B, and X on an XBox 360-style gamepad) are used for acceleration, lasers, and teleportation, respectively. The controls are listed in an instructions menu.
       
    2. b.
      To be proficient at this game, the player will need to be able to precisely control the movement of the spaceship and predict the position of the rocks to line up shots from a distance. Maintaining a large distance between the spaceship and the rocks minimizes the chance that the shields will be damaged, but also makes it more difficult to obtain the items that can be dropped.
       
    3. c.
      The amount of power remaining in the shields is indicated visually by the shield graphic. A number indicating the points earned by the player is displayed in the top-center of the screen; the user interface is kept simple to avoid overlapping game-world elements as much as possible. When each level is complete, a congratulations message appears on the screen, as well as the number of seconds it took to clear the screen and the corresponding point bonus; the player presses a key to continue on to the next level.
       
    4. d.
      The menu system is navigated by using the mouse. There will be a start menu that displays a title graphic, the highest score earned, and buttons that allow the player to go to an instructions menu or begin the game right away (for experienced players). The instructions menu displays the backstory, lists the controls (keyboard and gamepad) for the game, and has a button that allows the player to return to the main menu. When the player loses the game, a “Game Over” message appears, along with another message if the player has earned a high score, followed by a button that allows the player to return to the start menu.
       
    5. e.
      There is no in-game pause or volume-control functionality. The player can quit the game at any time by clicking on the standard window controls located in the top-right corner of the window.
       
     
  4. 4.
    Aesthetics
    1. a.
      The game is set in outer space and has many technological elements. The game world feels increasingly cluttered and chaotic due to the increasingly large number of rocks drifting around at random angles. As the rocks are destroyed in each level, the pace becomes more relaxed.
       
    2. b.
      The graphics are colorful and cartoonish. There will be a variety of background images used to make the levels feel different. The basic graphics required will be the spaceship, lasers, and rocks. There will be visual special effects corresponding to player actions and interactions between game-world objects:
      1. i.
        A particle effect simulating thruster fire will appear whenever the player accelerates the spaceship.
         
      2. ii.
        The shields will have a slow rotation and pulse effect to make them appear more dynamic, and their opacity will change according to the remaining shield power.
         
      3. iii.
        Lasers will fade out before they disappear.
         
      4. iv.
        When teleporting, a wormhole-like animation will appear at the original and the new locations of the spaceship.
         
      5. v.
        Whenever a rock is destroyed (from laser or shield collision), the rock will disappear and an explosion will appear in its place.
         
      6. vi.
        Items will feature a pulsing effect to draw the player’s attention and will fade out before they disappear. If they are collected, a small sparkling effect will appear.
         
       
    3. c.
      The menus will feature a quiet, ambient technological humming or droning sound, as one might imagine in the background of a spaceship. A small beep will play when navigation buttons are pressed. The game itself will feature exciting, driving background music to reinforce the mood of the game. Analogous to the visual effects described previously, there will be sound effects corresponding to player actions and interactions between game-world objects:
      1. i.
        A continuous rocket exhaust sound will play as long as the player is accelerating the spaceship.
         
      2. ii.
        When a rock collides with the shields, an electric shock–like sound will play.
         
      3. iii.
        A laser fire sound will play when each laser is shot.
         
      4. iv.
        When teleporting, a deep whoosh-like sound will play.
         
      5. v.
        Whenever a rock is destroyed, a rumbling explosion sound will be heard.
         
      6. vi.
        If an item is collected, a quiet chime sound will play.
         
       
    4. d.
      The backstory for the game is: “You are a spaceship pilot tasked with clearing out the interstellar debris that makes deep-space voyages dangerous for less-experienced pilots. With the aid of your advanced laser, shield, and teleportation technology, destroy as many rocks as you can before your own ship is destroyed and you are teleported back to your home base.”
       
    5. e.
      This game creates a feeling of excitement and tension.
       
    6. f.
      The fun aspect of this game comes from competition with oneself and with others to achieve the highest score possible. (Each player will have to keep track of their own high scores.)
       
     
  5. 5.
    Development
    1. a.
      This project will completed individually; graphics and audio will be obtained from third-party websites that make their assets available under the Creative Commons license, and so the main task will be programming.
       
    2. b.
      A desktop computer (with keyboard, mouse, and speakers), a gamepad controller, and internet access will be necessary to complete this project. Playtesting can be performed on-site or remotely.
       
    3. c.
      The main sequence of steps to complete this project is as follows:
      1. i.
        Obtain graphics.
         
      2. ii.
        Program ship movement and abilities (laser fire, teleportation, shields).
         
      3. iii.
        Program rock movement and laser-rock interaction.
         
      4. iv.
        Implement user interface (point system and high-score storage) and game-over screen.
         
      5. v.
        Add items (shield recharge and bonus points).
         
      6. vi.
        Add visual effects, music, and sound effects.
         
      7. vii.
        Load new level with increased difficulty when screen is cleared.
         
      8. viii.
        Menu system (start and instructions screens)
         
      9. ix.
        Gamepad support
         
       
    4. d.
      The main points for playtesting are after the user interface is finished, after the new level feature is added, and after all the preceding steps have been completed. The questions that will be asked are:
      1. i.
        How do the spaceship controls feel: too slow/sluggish, too fast, or just right?
         
      2. ii.
        Is the gameplay too hard or too easy, too short or too long?
         
      3. iii.
        Does the difficulty level increase at a slow, moderate, or fast pace?
         
      4. iv.
        Do you have any suggestions to improve this game?
         
       
    5. e.
      This game will be disseminated for free as an executable file through various indie game-portal websites, and gameplay images and video will be posted via social media.
       
     

Appendix B: Review of Java Fundamentals

This appendix will briefly review the core Java concepts that you should be familiar with to understand the material presented in this book. This is not a complete introduction to Java programming, so if any of the topics are unfamiliar, you may want to consult a textbook or tutorial series on Java 3 to learn more about the corresponding material.

Data Types and Operators

Let’s begin by listing some of the basic, or primitive , data types available in Java:
  • int : Integers (numbers with no decimal part)
  • float : Decimal values
  • double : Decimal values, stored with twice the precision of a float
  • char : A single character (a letter, number, or symbol)
  • boolean : The value true or false
Another commonly used data type is String , which represents text: a set of characters. Technically, this is not a primitive data type, but it can be initialized in a similar way.
Java also uses the common binary arithmetic operators : addition, subtraction, multiplication, division (or quotient, in the case of integers), and remainder, represented by the symbols + , - , * , / , and % , respectively. When used with two values of the same type, the result will also be of the same type. For example, the value of 5.0/2.0 is 2.5 , whereas the value of 5/2 is 2 . The results are different because in the first example the values have type double , and in the second example the values have type int .
When performing arithmetic involving two types of values, the values will be converted, or cast , to the more complex type. For instance, 5.0/2 yields a value of 2.5 . If desired, a numeric value of one type can be manually cast to another type by prefacing it with the name of the desired type in parentheses. For example, (double)2 produces a value of 2.0 , whereas (int)2.5 produces the value 2 . (When casting to an int , the value is always rounded down to the nearest integer value.)
Primitive variables can be declared and initialized with a single line of code, with the following syntax:
variableType variableName = initialValue;
Alternatively, these tasks can be carried out in separate statements:
variableType variableName;
variableName = initialValue;
In addition to using = to assign values to variables, Java provides assignment operators (for brevity), which modify the value of a variable by a constant amount. For example, the statement x = x + 5 can be replaced with the statement x += 5 . Each of the other arithmetic operations has a corresponding assignment operator: -= , *= , /= , and %= .
Numeric values can be compared with the conditional operators: == for equality, != for inequality, < for less than, <= for less than or equal to, > for greater than, and >= for greater than or equal to. The result of a comparison is a Boolean value— true or false —and can be stored in a Boolean variable if desired. Boolean values can be combined with the Boolean operators: && for “and,” || for “or,” and ! for “not.”
An array is an object that contains a fixed number of values of the same type. The length of the array is set when the array is created. The values in an array can be initialized when it is created (and the size will be inferred). For example, the following creates an array that contains five characters:
char[] letters = { 'g' , 'a' , 'm' , 'e' , 's' } ;
Alternatively, an array can be created with only the length specified, shown here for an array that will contain ten integers (and the values can be set at a later time):
int[] values = new int[10];
The items in an array are accessed by their position, or index, which begins with the number 0 . For example, given the preceding array named letters , the expression letters[0] produces the value 'g' , letters[1] produces 'a' , and so forth, up to letters[4] , which produces 's' . Note that the array has length 5, but the positions are numbered 0 through 4. (This is true in general; an array with length n will have indices numbered 0 through n – 1.) Note that once an array is created, its size cannot be changed; trying to store a value in an array at a nonexistent index value will result in an error when the program is running.

Control Structures

The statements within a Java program are typically run one after the other in sequence. Control structures can change the order of execution, either by running some statements only when certain conditions are met or by repeating a given set of statements.

Conditional Statements

An if statement is used to specify that a certain set of statements should be run only when a certain condition (or combination of conditions or a Boolean expression) evaluates to true. For example, the following code will add 100 to the variable bonus only if the value of time is greater than 60 ; if the value of time is not greater than 60 , the code contained within the braces will not be executed.
if (time > 60)
{
    bonus += 100;
}
Any number of statements may be contained within the braces. However, if only one statement is contained within the braces, the braces may be omitted, and the code will have the same results, as follows:
if (time > 60)
    bonus += 100;
An if-else statement is used when you need to provide an alternative set of statements that will be executed when the associated condition evaluates to false . The following code builds on the previous example, adding the behavior that if the value of time is not greater than 60 , then the value of bonus will be incremented by 50 instead.
if (time > 60)
{
    bonus += 100;
}
else
{
    bonus += 50;
}
On occasion, you may want to test a variable for equality against a set of values and execute a different set of statements in each case. For example, consider the following code, which prints a message depending on whether the value of itemCount is equal to 0 , 1 , 2 , or anything else.
if (itemCount == 0)
    System.out.print("You have no items.");
else if (itemCount == 1)
    System.out.print("You have a single item.");
else if (itemCount == 2)
    System.out.print("You have two items.");
else
    System.out.print("You have many items!");
A switch statement presents an alternative way to write this type of code (which is often easier to read). The following code features a switch statement that has exactly the same effect as the if-else statements presented previously. Each of the value comparisons in the if-else statements correspond to an occurrence of the case keyword within the switch code block, while the final else statement corresponds to the default keyword. After listing the set of statements to be executed for a given case, a break statement must be included (otherwise, the statements corresponding to the following cases will also be executed, regardless of whether the variable is equal to the value presented) .
switch (itemCount)
{
    case 0:
        System.out.print("You have no items.");
        break;
    case 1:
        System.out.print("You have a single item.");
        break;
    case 2:
        System.out.print("You have two items.");
        break;
    default:
        System.out.print("You have many items!");
}

Repetition Statements

The while statement is used to repeat a set of statements as long as a given condition is true. For example, the following code will continue to add 5 to the variable score and subtract 1 from the value of stars as long as the value of stars is greater than 0 :
while (stars > 0)
{
    score += 5;
    stars -= 1;
}
A while statement is particularly useful when a set of statements needs to be repeated an unknown number of times. You must be careful when using a while statement, however, because if the associated condition always remains true, then the statements will continue to execute forever!
The for statement is used to repeat a set of statements a fixed number of times. In typical usage, a variable is set to an initial value, and as long as a condition involving the variable is true, a set of statements is executed. Afterward, the value of the variable is changed by a given amount, the condition is checked again, and so forth, until the given condition evaluates to false. The following example initially sets a variable n to 1 , and as long as n is less than 10 , adds 3 to points ; the value of n is increased by 1 with each iteration of the loop. Note that the statement n++ has the same effect as n += 1 .
for (int n = 1; n < 10; n++)
{
    points += 3;
}
For loops are particularly useful in tasks involving arrays. As an example, the following code initializes an array named numbers to store five integers, and the for loop stores the value 10*n at each position n in the array. Note that the loop variable is initialized to 0 (as this is the first index in an array), and the condition is that the variable is less than the length (that is, the size or the capacity) of the array. (You must use the less-than comparison in the condition, since the largest index in an array is always equal to the length of the array minus 1.)
int[] numbers = new int[5];
for (int index = 0; index < numbers.length; index++)
{
        numbers[index] = 10 * index;
}
A variation on the syntax of the for statement, called the enhanced for statement, is convenient for accessing the values of an array. As a motivating example, consider the following code, which takes each of the values from an array called grades and adds them all to a variable called total :
for (int index = 0; index < grades.length; index++)
{
    int num = grades[index];
    total += num;
}
The exact same result can be achieved with less code using the following code, which automatically extracts the elements of an array (in order), and stores them into a variable before proceeding to the statements contained within the loop:
for (int num : grades)
{
    total += num;
}

Methods

A method is a set of statements, grouped together, that can be called upon repeatedly to perform a task. Every method has an associated name, can take zero or more values as input, and may or may not return a value. Each method is contained within a structure called a class , which is covered in further detail later. The syntax for a method is presented here, and the various components are summarized immediately afterward:
modifer returnType methodName ( variableType variableName , ... )
{
      // statements
}
  • modifier is a keyword (such as public or private ) that indicates where this method can be used in the program (see later in the appendix for more information).
  • returnType indicates the type of data being returned and can be set to void if no data is returned by the method.
  • methodName is the name of the method.
Within the parentheses, for each input that is to be provided, you must list the type of input (indicated by variableType ) and the name by which it will be referred to in the statements that follow (indicated by variableName ).
For example, the following public-access method called average takes two float values as input, calculates their average (which is also a float ), and returns this value:
public float average(float x, float y)
{
    return (x + y) / 2;
}
Methods can be called upon in two ways, depending on how they are written. Some methods may be called from the class that contains them. For example, the Math class contains a method named sqrt that calculates the square root of a number; to use this method to calculate the square root of 4, you would write Math.sqrt(4) . Alternatively, some methods are called from a variable. As an example, every String variable contains a method named charAt that returns the character at a given position in the string. If you create a String named word that contains the text “ games,” then word.charAt(2) returns the character 'm' .

Objects and Classes

An object is a collection of related data and methods that operate on that data. A class is a set of code that is used as a prototype or a blueprint from which objects can be created. Some classes are automatically available in Java (such as the String , Math , and System classes). To use other classes in your program, you must indicate which of the many available classes should be loaded by using an import statement. For example, to be able to use the Random class in your program, which is part of the java.util package, 4 at the beginning of your program you must include this line:
import java.util.Random;
To create an object from this class (also called an instance of the class), you use the new operator, followed by a special method of the class called the constructor . The name of the constructor method will always be identical to the name of the corresponding class, and it may require input values to initialize the data that belongs to the class. For example, to create an instance of the Random class, you would use the following code:
Random rand = new Random();
Following this, you could then use the methods of the variable rand , such as nextInt (which returns a randomly generated integer), as follows:
int secret = rand.nextInt();
The previously mentioned String class is special in that it may be initialized in the same way as a primitive type variable (like int or float ), but it may also be initialized using the new operator (which requires the text to be stored as input):
String name = new String("Lee");
One of the most powerful features of Java (or any object-oriented programming language) is the ability to define your own classes. As an example, the following class, called Fraction , stores the data used in a fractional number: a numerator and a denominator (both integers). There is a constructor to set these values, a method to create a String representation of the fraction, and a method to convert the fraction to a float value (by calculating the quotient).
class Fraction
{
    int numerator;
    int denominator;
    // constructor
    Fraction(int n, int d)
    {
        numerator = n;
        denominator = d;
    }
    // creates a String representation
    public String toString()
    {
        return (numerator + "/" + denominator);
    }
    // convert to a float value
    public float convertToFloat()
    {
        return (float)numerator / denominator;
    }
}
Next is a sample class that uses the Fraction class as defined previously. In particular, it contains a method named main that you will run, which creates and initializes a Fraction object and then uses its methods and prints their results to the screen. A technical aside: you must declare the main method as static in order to be able to run the method directly from the class (with the code Sample.main() ) rather than from an instance of the class .
class Sample
{
    public static void main()
    {
        Fraction frac = new Fraction(3,4);
        String fracString = frac.toString();
        float  fracValue  = frac.convertToFloat();
        System.out.println( "The value of " + fracString + " is " + fracValue );
    }
}
Sometimes, when you write a class, you’ll want to control access to data, either to restrict the possible set of values that can be assigned or to prevent another part of the program from accidentally changing the data (possibly due to a mistake in the code). Access modifiers are used in such situations; they can be included to specify whether other classes can use a particular field or method. The two most common modifiers are public , which indicates that any class can access the corresponding variable or method, and private , which indicates that it may be accessed only within the class in which it is defined. There is a less frequently used modifier, protected , which allows access within the defining class and any subclasses of (that is, those that extend) the defining class.
As a practical example of when access modifiers are useful, let’s return to our custom Fraction class. The denominator of a fraction should never be set equal to zero (because division by zero leads to contradictory mathematical results). You prevent this unwanted behavior by setting the class fields to private and rewriting the constructor (or any other relevant methods) to take action in this case, as demonstrated here:
class Fraction
{
    private int numerator;
    private int denominator;
    // constructor
    Fraction(int n, int d)
    {
        numerator = n;
        if (d == 0)
        {
            System.err.println("Invalid denominator; changing value to 1.");
            denominator = 1;
        }
        else
        {
            denominator = d;
        }
    }
    // other methods remain the same as before
}

Summary

These topics—data types, operators, control structures, methods, and classes—are the foundations on which you will create your own programs. In real applications, your code will typically be much longer than the examples presented; your classes will no doubt contain multiple import statements, declare many variables of various types, and have an assortment of methods, each of which contains a significant number of statements. When working on your own projects, in addition to writing your own classes, your programs will probably use many predefined classes as well. For this reason, it is good to spend some time becoming familiar with the style and type of information that is presented in the Java documentation format, whether it be the official Java language reference 5 or the documentation for any Java libraries you include in your projects.

Appendix C: Extended Framework Class Reference

In this book, you have developed multiple classes to extend the LibGDX framework. Each of these new classes in turn contains many fields and methods. For your convenience, this appendix contains a summary of the functionality of the most important classes that are used across multiple chapters: BaseScreen , BaseActor , and TilemapActor .

The BaseScreen Class

The BaseScreen class was introduced in Chapter 3 to support games that contain multiple screens and to simplify the implementation of the game loop. You extend this class in nearly every game project in this book. There are two abstract methods that extensions of this class must implement: initialize , which is where you set up game entities, and update , which processes continuous user input (such as a character that moves as long as a key is held down) and handles the game logic (such as interactions between game entities). This class also implements the InputProcessor interface , which enables extensions of this class to handle discrete input (such as a character that jumps one time when a key is pressed) by overriding methods such as keyDown .

Constructor

  • BaseScreen()
    Initializes mainStage , uiStage , and uiTable

Fields

  • protected Stage mainStage
    The stage to which all game entities should be added
  • protected Stage uiStage
    The stage that contains the user-interface table
  • protected Table uiTable
    A table used to organize user-interface elements

Methods

  • void dispose()
    Called when this screen should release all resources
  • void hide()
    Called when this is no longer the active screen in a game
  • abstract void initialize()
    Used to initialize game objects and arrange user-interface elements.
  • boolean isTouchDownEvent(Event e)
    Used for checking if an event is a touch-down event.
  • boolean keyDown(int keycode)
    Called when a key is pressed. (This and other InputProcessor methods return true if input is processed and should not be handled by any other methods or InputProcessor objects.)
  • boolean keyTyped(char c)
    Called when a key is typed
  • boolean keyUp(int keycode)
    Called when a key is released
  • boolean mouseMoved(int screenX, int screenY)
    Called when the mouse is moved without any buttons’ being pressed
  • void pause()
    Only called in Android applications when application is paused
  • void render(float dt)
    Called when the screen should render itself
  • void resize(int width, int height)
    Called when the application window is resized
  • void resume()
    Only called in Android applications when application is resumed (after being paused)
  • boolean scrolled(int amount)
    Called when the mouse wheel is scrolled
  • void show()
    Called when this becomes the active screen in a game.
  • boolean touchDown(int screenX, int screenY, int pointer, int button)
    Called when the screen is touched or a mouse button is pressed
  • boolean touchDragged(int screenX, int screenY, int pointer)
    Called when a finger or the mouse is dragged
  • boolean touchUp(int screenX, int screenY, int pointer, int button)
    Called when a finger is lifted or a mouse button is released
  • abstract void update(float dt)
    Processes continuous input and updates game logic

The BaseActor Class

The BaseActor class was introduced in Chapter 3 to support many of the features needed for game entities : creating and rendering animations, implementing physics-based movement, and detecting and preventing collisions. A few methods were introduced in later chapters as necessary (such as wrapAroundWorld in Chapter 4 and isWithinDistance in Chapter 5 ). The BaseActor class also greatly simplifies retrieving lists of instances of a particular class with its getList method.

Constructor

  • BaseActor(float x, float y, Stage s)
    Sets initial position of actor and adds to stage

Methods

  • void accelerateAtAngle(float angle)
    Updates accelerate vector by angle and value stored in acceleration field
  • void accelerateForward()
    Updates accelerate vector by current rotation angle and value stored in acceleration field
  • void act(float dt)
    Processes all actions and related code for this object; automatically called by act method in Stage class
  • void alignCamera()
    Center camera on this object while keeping camera’s range of view (determined by screen size) completely within world bounds.
  • void applyPhysics(float dt)
    Adjust velocity vector based on acceleration, deceleration, and maximum speed, then adjust position based on velocity vector.
  • void boundToWorld()
    If an edge of an object moves past the world bounds, this adjusts its position to keep it completely on screen.
  • void centerAtActor(BaseActor other)
    Repositions this BaseActor so its center is aligned with center of other BaseActor
  • void centerAtPosition(float x, float y)
    Aligns center of actor at given position coordinates
  • static int count(Stage, String className)
    Returns number of instances of a given class (that extends BaseActor )
  • void draw(Batch batch, float parentAlpha)
    Draws current frame of animation; automatically called by draw method in Stage class
  • Polygon getBoundaryPolygon()
    Returns bounding polygon for this BaseActor , adjusted by Actor ’s current position and rotation
  • static ArrayList<BaseActor> getList(Stage stage, String className)
    Retrieves a list of all instances of the object from the given stage with the given class name or whose class extends the class with the given name
  • float getMotionAngle()
    Gets the angle of motion (in degrees), calculated from the velocity vector
  • float getSpeed()
    Calculates the speed of movement (in pixels/second)
  • static Rectangle getWorldBounds()
    Gets world dimensions (width and height)
  • boolean isAnimationFinished()
    Checks if animation is complete: if play mode is normal (not looping) and elapsed time is greater than time corresponding to last frame
  • boolean isMoving()
    Determines if this object is moving (if speed is greater than zero)
  • boolean isWithinDistance(float distance, BaseActor other)
    Determines if this BaseActor is near other BaseActor (according to collision polygons)
  • Animation<TextureRegion> loadAnimationFromFiles(String[] fileNames,
            float frameDuration, boolean loop)
    Creates an animation from images stored in separate files.
  • Animation<TextureRegion> loadAnimationFromSheet(String fileName,
            int rows, int cols, float frameDuration, boolean loop)
    Creates an animation from a spritesheet: a rectangular grid of images stored in a single file.
  • Animation<TextureRegion> loadTexture(String fileName)
    Convenience method for creating a one-frame animation from a single texture.
  • boolean overlaps(BaseActor other)
    Determine if this BaseActor overlaps other BaseActor (according to collision polygons)
  • Vector2 preventOverlap(BaseActor other)
    Implement a “solid”-like behavior: when there is overlap, move this BaseActor away from other BaseActor along minimum translation vector until there is no overlap.
  • void setAcceleration(float acc)
    Set acceleration of this object.
  • void setAnimation(Animation<TextureRegion> anim)
    Sets the animation used when rendering this actor; also sets actor size.
  • void setAnimationPaused(boolean pause)
    Sets the pause state of the animation.
  • void setBoundaryPolygon(int numSides)
    Replaces default (rectangle) collision polygon with an n -sided polygon
  • void setBoundaryRectangle()
    Sets rectangular-shaped collision polygon
  • void setDeceleration(float dec)
    Sets deceleration of this object
  • void setMaxSpeed(float ms)
    Sets maximum speed of this object
  • void setMotionAngle(float angle)
    Sets the angle of motion (in degrees)
  • void setOpacity(float opacity)
    Sets the opacity of this actor
  • void setSpeed(float speed)
    Sets the speed of movement (in pixels/second) in current direction
  • static void setWorldBounds(BaseActor ba)
    Sets world dimensions for use by methods alignCamera() and boundToWorld()
  • static void setWorldBounds(float width, float height)
    Sets world dimensions for use by methods alignCamera() and boundToWorld ().
  • void wrapAroundWorld()
    If this object moves completely past the world bounds, adjust its position to the opposite side of the world.

The TilemapActor Class

The TilemapActor class is used to work with files created by the Tiled map editor program. It automatically renders any image layers or tile layers and can retrieve data stored as rectangles or tiles in an object layer. This class is first created in Chapter 10 and used extensively in Chapters 11 and 12 .

Constructor

  • TilemapActor(String filename, Stage theStage)
    Loads a Tiled map data file ( *.tmx ) with a given filename and adds it to a stage so that the tilemap automatically renders.

Fields

  • static int windowHeight
    The width of the window where the tilemap will be rendered
  • static int windowHeight
    The width of the window where the tilemap will be rendered

Methods

  • void act(float dt)
    Automatically called by the Stage to which this actor is attached
  • void draw(Batch batch, float parentAlpha)
    Automatically called by the Stage to which this actor is attached; keeps the map camera position in sync with the stage camera position and renders the map to the screen.
  • ArrayList<MapObject> getRectangleList(String propertyName)
    Searches the map layers for Rectangle objects that contain a property (key) called "name" with associated value propertyName ; typically used to store non-actor information such as spawn-point locations or dimensions of Solid objects.
  • ArrayList<MapObject> getTileList(String propertyName)
    Searches the map layers for Tile Objects (tile-like elements of object layers) that contain a property (key) called “name” with associated value propertyName ; typically used to store actor information and to create instances.
Index
A
Abstract class
Adventure games
See alsoTreasure Quest game
Ambient light
Android Studio
Animation
image-based
SeeImage-based animations
value-based
Anonymous inner class
Anonymous instance
Audacity
Audio
Rhythm Tappergame
SeeRhythm Tapper game
sound and music
Audionautix websites
B
BaseActor3D class
create
enable actor
Matrix4 object
position variable
resizing model
rotating
turn angle
BaseActor class
constructor
game entities
methods
BaseScreen class
abstract methods
constructor
fields
InputProcessor interface
methods
Bfxr websites
Blip-like sound effect
BlueJ
code editor
download options
features
installation
Open Editor selection
project window
text display
Blur shader
Border shader
BounceOff method
Breadth-first search algorithm
C
52 Card Pickup
See alsoSolitaire card game
Cloning the classics approach
Collectible card game
Cool Text websites
Crazy Eights game
Cutscenes
BaseActor class
DelayAction
DialogBox
framework
SceneActions
Scene class act method
SceneSegment
SetTextAction
Starfish Collector game
static methods
StoryScreen class
D
Default shaders
attribute variables
fragment shader
keywords and commands
mathematical functions
position, color, and texture coordinates
texture2D function, color data
transformation matrix
uniform variables
variable types, OpenGL
varying variables
vertex shader
Depth-first search
2.5D games
3D graphics
ambient light
BaseActor3Dclass
SeeBaseActor3D class
camera
create minimal code
ApplicationListener interface
box dimensions
create method
CubeDemo
3D application
DirectionalLight
glClear function
lookAt method
PerspectiveCamera
Project3D
render method
Usage class
create scenes
directional light
interactive demo
in action
BaseGame class
Box class
create BaseScreen class
create flat box
create sphere
DemoScreen class
keyboard keys
MoveDemo class
material
mesh
ModelBatch class
orthographic camera
perspective camera
Stage3Dclass
SeeStage3D class
Starfish Collector 3Dgame
SeeStarfish Collector 3D game
Utah teapot
vanishing point
Directional light
Dodging enemy planes
Drag-and-drop functionality
DragAndDropActor
enable actors
InputListener
Interpolation object
jigsaw puzzlegame
SeeJigsaw puzzle game
solitaire cardgame
SeeSolitaire card game
touchDragged method
touch methods
two extra functions
visual effect
Driver class
DrJava
E
Eclipse
Ellipsoids
Enumerated type
Explosion particle effect
F
Falling boxes
FileUtils
Freesound websites
FreeTypeFontGenerator class
Functional interface
Fundamentals of Game Design (book)
G
Gamasutra website
GameArtGuppy websites
Game design document (GDD)
aesthetics
blueprint
development
dynamics
flexibility, developers
mechanics
overall vision
SpaceRocks
SeeSpace Rocks game
standard format
templates
GameDev.net
Game entities
act method
Actor class
ActorBeta class
draw method
HealthyActor method
LauncherBeta
overlaps method
overriding methods
setTexture method
Stage class
StarfishCollectorBeta class
superclass method
TextureRegion
textures
Turtle class
winMessage
Game flow
abstract class
design practice
GameBeta class
game loop
StarfishCollectorBeta class
update and render methods
Game jam
Gamepad controllers
components
continuous input
array of controllers
Controllers class
deadzone
gamepad mapping
getAxis(code)
getButton(code)
getPov(num)
get-style methods
Turtle class
XBoxGamepad
discrete input
BaseGamepadScreen class
BaseScreen class
buttonDown method
ControllerListener interface
LevelScreen class
listeners
JAR files
keyboard input
LibGDX libraries
USB ports
Xbox 360 and Logitech F310
Game-World objects
coins
flag
keys and locks
level design, tiled map editor
platforms
springboards
time and timers
user interface
GDD
SeeGame design document (GDD)
Genre
Gimbal lock
Global Game Jam
Glow shader
Grayscale shader
H
Health points (HP)
Hiero application
High-rank cards
HobbyGameDev website
I
Image-based animations
BaseActor
GameBeta
generic class
getKeyFrame
isAnimationFinished()
keyframes
Launcher class
spritesheet
Turtle class
Whirlpool class
Image-based button
Incompetech websites
Infinite scrolling effect
Inkscape website
Inner class
Input polling
Insert Tile tool
Integrated development environment (IDE)
IntelliJ IDEA
J
Java Archive (JAR) files
create executable
main options
Java Development Kit (JDK)
Java fundamentals
control structures
conditional statements
repetition statements
data types and operators
methods
objects and classes
JavaFX frameworks
class
FileUtils
showDialog method
thread
toolkit
Jigsaw Puzzle game
BaseActor class
create projects
DropTargetActor
initialize method
LevelScreen class
objects
pieces
PuzzleArea class
PuzzlePiece class
schematic view
TextureRegion class split method
update method
Jumping Jack game
arrow keys
framework
getTileList method
platform and lock objects
platform character setup
acceleration vector
BaseActor class
belowSensor
collision polygon
deceleration amount
Koala class
LevelScreen class
MathUtils class clamp method
physics-related methods
preventOverlap method
sensor box
spacebar key
variable declaration
rectangle objects adding
solid objects
Stamp Brush tool
tiled map-editor software
Tileset panel
K
Kenney Game Assets websites
Keystroke-recording application
FunkyJunky.key
KeyTimePair
RecorderGame class
RecorderScreen class
Record Keystrokes
screenshot
SongData class
task
text file
L
Lambda expressions
Layouts with tables
BaseScreen constructor method
contents
LevelScreen class
MenuScreen class
methods
pad method
text-based mechanics
variable declaration
LibGDX
FileHandle
IDE
internal method
music object
platform-dependent objects
readString method
setup tool
sound and music
wiki
writeString method
LibGDX framework
ApplicationListener interface
audio stage
game loop stage
interfaces
Monster class
Person class
Player class
talkTo method
LwjglApplication
process input
render
shutdown stage
sleep stage
stages of
Starfish Collector
startup stage
update
LibGDX library
advantages
BlueJ
SeeBlueJ
Hello, World program
castSpell
creation
driver class
extending classes
Gdx class
HelloLauncher class
HelloWorldImage class
instance-based method
LWJGL
Person class
static methods
IDE
software libraries
LibGDX Particle Editor
emitter properties
fine-tuning parameter values
numeric values
parameters
ParticleEditor.jar
Space Rocks project
startup
tint parameter graph
user interface
variations, parameter change graph
Lightweight Java Game Library (LWJGL)
Ludum Dare, jam events
M
Magic points (MP)
Matrix4 object
Maze Runman game
animations
audio
benefit
BlueJ
branching points
Coin class
depth-first search
endgame conditions
findPath method
generation
ghost
add goal for player
add variables
breadth-first search algorithm
currentRoom
findPath method
Ghost class
LevelScreen class
Maze class
previousRoom
Room class
shortest paths to hero
startRoom
targetRoom
visited
the hero
hybrid approach
incorporate techniques
Launcher class
LevelScreen class
Maze class
MazeGame class
neighboring unconnected rooms
overview
procedural content generation
pseudocode algorithm
remove walls at random
Room class
sample mazes
toFront method
top-down perspective
user interface
Wall class
wallsToRemove value
Mechanics-Dynamics-Aesthetics (MDA)
Mesh
The Missing Homework
Background class
BaseGame class
BaseScreen class
BlueJ project
classroom method
hallway method
Kelsoe class
keyDown method
library method
locations
MenuScreen class
SceneActions class
scienceLab method
screenshots
SetAnimationAction class
StoryScreen class
TypewriterAction class
visual novel
Music class dispose method
Music interface
N
NetBeans
Nine-patch image
Non-player characters (NPCs)
O
Ocenaudio
One Game a Month
OpenGameArt websites
Orthogonal projection
Overriding methods
P
Parallax effect
ParticleActor class
Particle systems
emitter
explosion effect
LibGDX Particle Editor
ParticleActor class
rocket-thruster effect
Space Rocks game
Perspective projection
Pitch angle
Plane Dodger game
collectible stars
collision with enemy plane
collision with star
create visual effects
CustomGame class
dodging enemy planes
enable audio
endgame conditions
enemy planes
Ground class
infinite scrolling effect
Launcher class
LevelScreen
parallax effect
Plane class
Sky class
spacebar key
stars
start project
uses
Polygons
detecting collisions
solid objects
vs . rectangles
Pseudocode algorithm
Pulsing effect
Q
Quaternion
QuitFunction class
R
Reality Is Broken: Why Games Make Us Better and How They Can Change the World (book)
Rectangle Destroyer game
BounceOff method
brick-colors.png
colorful layout of bricks
color property
create project
enumerated type
game object
ball
bricks
paddle
walls
getTileList method
initialize method
item effect
items
Launcher class
music
paddle
paddle-shrinking item
sounds
Tiled map-editor program
brick tiles
color
create new tileset
“Embed in map”
general map settings
grid squares
Image Layer 1
Insert Rectangle tool
Insert Tile tool
Layer menu
Select Objects tool
user interface
add variable
touchDown method
uiTable
update method
Rhythm Tapper game
add visual effects
advanceTimer variable
ArrayList objects
countdown method
create new project
FallingBox class
falling boxes
fb.remove() code
genre
goal
initialize method
keys
Message class
pulsing effect
RhythmGame class
RhythmLauncher class
RhythmScreen class
screenshot
TargetBox class
update method
user interface
initialize method
keyDown method
Message class
pulseFade method
RhythmScreen class
uiTable
update method
Rocket-thruster particle effect
Role-playing game
Roll angle
Rollin at 5 music
S
Shader programs
blur
border
custom uniform values
default
SeeDefault shaders
fragment processing
glow effect
GPU
graphics pipeline
grayscale
LibGDX, Starfish Collector project
OpenGL
rasterizing
rendering graphics
texture coordinates
vertex processing
wave-distortion
Shoot-em-up game
See alsoSpace Rocks game
Side-scrolling action game
See alsoPlane Dodger game
Signs and dialog boxes
BaseActor class
BaseScreen class
BlueJ project
DialogBox
game elements
in-game signs
setDialogSize method
sign-reading mechanic
update method
Sky dome
Solitaire card game
Card class
create project
drop card onto pile
high-rank cards
initialize method
Interpolation class
LevelScreen class
low-rank cards
Pile class
piles
rank
schematic view
suits
update method
Sound effects
Space Rocks game
act method
add shields
aesthetics
BaseActor class
BaseGame class
constructor method
continuous actions
create new project
development
discrete action
draw method
dynamics
endgame conditions
Explosion class
game design document
getStage method
graphics
Group class
InputMultiplexer class
input polling
InputProcessor interface
keyDown method
Laser class
Launcher class
LevelScreen class
MathUtils class
mechanics
mouse-based action
overall vision
project testing
pulsing effect
Rock class
show method
SpaceGame class
spaceship
Spaceship class
Stage class
teleporting
thruster effect
Warp class
Spriters Resource website
Stack Overflow
Stage3D class
act method
add and remove actors
BaseActor3D class
converting vector
create
lookAt method
setCameraDirection
tiltCamera
turnCamera
Vector3 object
Stamp Brush tool
Starfish Collector 3D game
BaseActor3D class
collision detection
detect overlap methods
2.5D games
goal
initialize method
LabelStyle object
Launcher3 class
LevelScreen class
ObjLoader
ObjModel class
polygon
Rock class
sky dome
StarfishCollector3DGame class
Turtle class
update method
Starfish Collector game
animation
SeeAnimation
ArrayList
assets folder
BaseActor
boundaries
collisionpolygons
SeePolygons
constructor
create tilemap
create new tileset
creating new map
custom properties
“Embed in map”
Eraser tool
general map settings
Image layer
Insert Rectangle tool
Insert Tile tool
loading background image
main window
map.tmx
message property
Name property
Object layer
Object Layer 1
ocean plant tileset
reordered layers
Select Objects tool
Snap to Grid setting
Stamp Brush tool
Tile layer
Tile Layer 1
create TilemapActor class
getRectangleList
getTileList method
getTile method
inputs
map object’s property
MapProperty objects
data structures
features
getRectangleList method
improvements
initialize method
LauncherAlpha
list
maze-like level
Message property
multiple screens
music class dispose method
ocean-plants.png
physics and movement
acceleration
applyPhysics method
velocity
sound and music
source code
StarfishCollectorAlpha
starfishTexture
Texture and SpriteBatch classes
user input
collision detection
glClear method
isKeyPressed method
method creation
overlapping
render method
water-drop sound effect
Swing frameworks
T
Text-based buttons
Text, displaying
bitmap fonts
FreeTypeFontGenerator class
using Hiero
labels
LabelStyle object
TextureRegion class split method
Textures.com
Thruster effect
Tiled software program
LibGDX
overview
Rectangle Destroyergame
SeeRectangle Destroyer game
Starfish Collectorgame
SeeStarfish Collector game
tilemap
tileset
XML
TilemapActor class
constructor
fields
methods
Touch methods
Touchscreen controls
arcade-style joystick
background image
BaseTouchScreen class
controlTable
deadzone radius
Drawable objects
images
initialize method
Label objects
parameters
placing, game controls
poorly placed, turtle
redesigning, window layout
Restart button
single-touch input
touchpad control, LibGDX
touchpad knob displacement data
Turtle class act method
user-interface control
Treasure Quest game
animations
arrows
BlueJ project
bushes and rocks
enemies
the hero
animations
arrow keys
attacking and destroying, Flyers
health points
initialize method
keyboard controls
movement direction
sprite sheets, character-walking animations
update method
item shop
level setup
adding grass and fence tiles
adventure-tiles
BlueJ
Bucket Fill tool
Gatekeeper
LevelScreen class
property
Rectangle tool
Select Object tool
Shopkeeper
solid objects
Stamp Brush tool
Tiled map-editor software
Tileset panel
NPCs
project requirement
purchasing items
sword
arc of rotation, swinging
initialize method
keyDown method
LevelScreen class
position of hero’s right hand
update method
swordfighting, Flyer enemies
tilemaps
user interface
collect coins
create class, Coin
create icons
health, coins, and arrows
initialize method
keyDown method
uiTable
update method
variables
weapons
Turn angle
U
The Ultimate Guide to Video Game Writing and Design (book)
User input, Starfish Collector game
keyboard controls
gamepadcontrollers
SeeGamepad controllers
touchscreencontrols
SeeTouchscreen controls
USB connector
Utah teapot
V
Value-based animations
Vanishing point
Vintage Games 2.0 (book)
W
Water-drop sound effect
Wave-distortion shader
Winged archer
X
Xbox 360 and Logitech F310 gamepad controllers
Y, Z
Yaw angle
Footnotes
1
Hunicke, LeBlanc, and Zubek. “MDA: a Formal Approach to Game Design and Research.” Proceedings of the Nineteenth National Conference on Artificial Intelligence , 2004.
 
2
Schell. The Art of Game Design: A Book of Lenses . CRC Press, 2008.
 
3
The official Java tutorials, maintained by the Oracle corporation, are available online at http://docs.oracle.com/javase/tutorial/java/index.html .
 
4
To find out the package that contains a particular class, you can consult the Java documentation or the documentation for the particular library you are using.
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset