Question: Consider the Mario example given in Section 8.2. That example explicitly did not consider interactions between the character and the environment within the game. Add

 Consider the Mario example given in Section 8.2. That example explicitlydid not consider interactions between the character and the environment within thegame. Add states, actions, and events to the example as appropriate toaccount for the following situations: - The character falls into a bottomless

Consider the Mario example given in Section 8.2. That example explicitly did not consider interactions between the character and the environment within the game. Add states, actions, and events to the example as appropriate to account for the following situations: - The character falls into a bottomless pit and the game ends. - The character is struck by a monster and the game ends. - The character jumps on a monster and kills it. Consider the classic platforming game Super Mario Brothers (or its many clones). This game may be modeled using a finite state machine. In order to simplify this example, we will only consider basic movement of the character in the game world, and not consider other events such as encounters with monsters, falling into bottomless pits, et cetera. As before, we will begin by considering the possible states in such a game. The character has only a few conditions that he may be in. He may be standing still, moving left, moving right, or jumping. Three events are possible: the player may press the 'jump' button (event J ), the player may press the 'left' button (event L), the player may press the 'right' button (event R), or the player may do nothing (event Z). In this simple example, the game's actions consist of playing animations. If the character is in a given state, the game will display an animation corresponding to the state that it is in. This animations will be moving left (ML), moving right (MR), jumping (MJ), and standing, or doing nothing (MZ) We can create a table of the states, actions, and events, as shown in Table 8.1. Figure 8.3 shows the finite state machine diagram for this machine. Note that the transfer function is very simple; perhaps even more so than for the up-down counter, as no arithmetic is involved. If the player presses a button corresponding to a state, the character goes into that state. stranefer funation: =vJenRt Uote enous in Table 8.1. in course notes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!