Presentation is loading. Please wait.

Presentation is loading. Please wait.

Collision Theory and Logic

Similar presentations


Presentation on theme: "Collision Theory and Logic"— Presentation transcript:

1

2 Collision Theory and Logic
Chapter 5 Collision Theory and Logic

3 Objectives Use game design software to create a playable video game.
Integrate animated objects into a video game. Create sound and music effects in a video game. Describe basic computer logic. Build applied mathematics logic statements. List features of object-oriented programming.

4 Logic The first concept of designing and programming a video game is an action– reaction relationship Programmers use logic statements to break down these action–reaction relationships You will need to understand the five basic operators of a programming language: IF, THEN, AND, OR, and ELSE

5 Logic (Continued) A logic statement tests a condition and determines an action based on the result An IF…THEN statement is the most basic example of a logic statement When programming a video game, the formal term for an action is a condition An event is a change that occurs when a condition is met

6 Logic (Continued) Programming for the user interface uses listeners and triggers A listener is programming that directs the computer to check or listen for a mouse click, key press, or other input from the user A trigger is programming for when a condition is met that a series of actions will begin In a logic statement, the trigger is the IF and the actions it initiates are the THEN

7 Logic (Continued) Goodheart-Willcox Publisher

8 Logic (Continued) Goodheart-Willcox Publisher

9 Logic (Continued) The next step in basic programming is to add multiple actions or multiple reactions to logic statements This is done using the AND and OR operators The AND operator will join two or more outcomes for a given condition or action The OR operator allows multiple results to take place under a given condition or event

10 Logic (Continued) The ELSE operator describes what will happen if a certain action or reaction does not take place The ELSE operator works like a true/false test If the condition is true, the THEN events are initiated If the condition is false, the ELSE events are initiated

11 Collision Theory Collision theory deals with an object running into or hitting another object When objects collide in a game, the movements, animations, and events must provide an illusion of reality Interactivity is how one object behaves when it encounters another object A collision statement must exist for each object the player touches for interaction

12 Programming with Collision Theory
When the computer recognizes a collision, it sets into action the events programmed by logic statements Games Factory 2 is an object-oriented, game development software that can be used to program a collision condition and events To make objects appear solid, the programmer needs to add some realistic effects to the collision Collision theory controls almost every interaction in video game action

13 Programming with Collision Theory (Continued)
Goodheart-Willcox Publisher

14 Writing a Logic Statement
Pseudo code is similar to computer code It helps by breaking down the interactions into the logical steps Another benefit of pseudo code is that it can be used as the structure for many different computer languages The programming words and symbols and their arrangement is called syntax

15 Pseudo code

16 Writing a Logic Statement (Continued)
Most high-level programming languages use syntax that reads like a regular sentence Definition subroutines are called objects Objects are defined by their attributes and properties Actions are how an object reacts to input or interacts with other objects Methods are the actions or verbs used in syntax

17 Writing a Logic Statement (Continued)
Variables are small information storage containers Text stored in a variable is called a string Arrays are a common data structure used to store and manipulate data There are four different loop commands common to most languages: LOOP, FOR, DO WHILE, and DO UNTIL

18 Writing a Logic Statement (Continued)
Programmers create the names for the objects, actions, methods, and variables used Persistence means that something continues to exist after the event that caused it has ended Modules are separate units of programming that perform one function and contain all the information needed to execute that function

19 Writing a Logic Statement (Continued)
The programming language used to code the game will do nothing on the computer until it is compiled into machine code The choice of programming language used has more to do with a programmer’s likes and dislikes than functionality To create a module within a game, it is important to plan all the parts of the operation using a flowchart or other organizational tool

20 Writing a Logic Statement (Continued)
An algorithm is a computer script that performs the steps needed to solve a problem Structure is the syntax and logic form of the programming language Sequence is the predetermined order or steps the computer program will follow An iteration is a single run through a programming loop

21 The Games Factory 2 The Games Factory 2 (TGF2) is a powerful game engine that uses object-oriented programming to make two-dimensional video games Two extremely beneficial features of TGF2 are that the game engine Runs very well on a standard PC Is very user friendly

22 Think about a video game you like to play
Think about a video game you like to play. What type of user inputs does the game accept? Describe a collision you have seen in a video game that did not seem realistic. How might the game be changed to make the collision seem more realistic?


Download ppt "Collision Theory and Logic"

Similar presentations


Ads by Google