Top Banner
31

5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

Apr 01, 2015

Download

Documents

Kassandra Dare
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.
Page 2: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

5

Collision Theory and

Logic

Page 3: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

• 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.• Debug a video game.• Describe basic computer logic.• Build applied mathematics logic statements.• List features of object oriented programming.

Page 4: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Basic Logic

• Action-reaction relationship• Condition and event or cause and effect• IF…THEN is the most basic logic statement• IF I drop a book, THEN it will make a noise

Page 5: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Game Logic Example

• IF the go-cart collides with the banana peel,• THEN the go-cart spins out

Page 6: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

User Interface Example

Page 7: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Advanced Logic Statements

• AND, OR, ELSE operators allow multiple actions or reactions• Multiple IF conditions• Multiple THEN operations

Page 8: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Advanced Logic Statements

• IF the dart collides with the balloon,• THEN destroy the balloon• AND create an explosion animation• AND add 100 points to the player’s score

Page 9: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Advanced Logic Statements

• IF the dart collides with a yellow balloon• AND• IF the yellow balloon overlaps any other balloon• THEN…

Page 10: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Advanced Logic Statements

• IF the number of darts is greater than 0• THEN load one dart in the hand• ELSE display the message “Game Over”

Page 11: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Logic Statements Feature

• A grasshopper jumps on a piece of food and the player earns 100 points:

grasshopper food

100 points

• IF __________ collides with _____,

• THEN add _________ to score

Page 12: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Logic Statements Feature

• A grasshopper jumps on a lily pad and does not fall into the water:

grasshopper lily pad

movement

• IF __________ collides with ________,

• THEN _________ stops.

Page 13: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Logic Statements Feature

• A grasshopper runs into a mushroom and falls into the water:

grasshopper mushroom

grasshopper

player

• IF __________ collides with __________,

• THEN ___________ movement falls

• AND ______ loses one life.

Page 14: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Logic Statements Feature

• A grasshopper runs into a four-leaf clover and earns 50 points and an extra life:

grasshopper collides with four-leaf clover

add 50 points to score

add one life to player

• IF __________________________________,

• THEN ___________________,

• AND __________________

Page 15: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Logic Statements Feature

• The player achieves 10,000 points and earns an extra life:

player score 10,000

one lives

• IF ___________ equals ________,

• THEN add _____ to the number of remaining _____

Page 16: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Collision Theory

• Collision is the most useful condition• Interactivity between game objects

• IF the coyote collides with the black spot, THEN the coyote falls

• The black spot acts like a hole

Page 17: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Collision Theory

• Collision statement glitch:• Spiko should sink in

water• Blue water image

should act like water

Page 18: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Collision Theory Feature

• Think about the collisions in bowling• List all of the actions and reactions you can

think of in the game• Write each collision as a logic statement with

IF, THEN, AND, OR, or ELSE operators

Page 19: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Relative Location

• Based on position of another game object• Example: an explosion placed relative to a popped

balloon• Relative coordinate is (0,0)

Page 20: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

The Games Factory 2

• Game engine developed by Clickteam• Object-oriented programming• Very easy to use• Drag-and-drop user interface

• Consists of several “views” or modules• Frame editor• Event editor• Storyboard editor

Page 21: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

The Games Factory 2 Frame Editor

• Used for scene design and layout

Page 22: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

The Games Factory 2 Frame Editor

• Library window• Standard tree-type organization• Drag-and-drop objects onto the game frame

Page 23: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

The Games Factory 2 Frame Editor

• Properties window• Contains various properties of selected object• Changing properties alters the object function

Page 24: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

The Games Factory 2 Event Editor View

• Events are programmed interactions• Conditions are the IF side of a logic statement• Reactions are THEN side of logic statement• Check marks (ticks) store reactions

Page 25: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

What relationship is used by game programmers to create a game environment that the player can control?

Action-reaction relationship

Page 26: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

What is a condition in game programming?

An action that causes something to happen.

Page 27: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

What is an event in game programming?

The change that occurs when a condition is met.

Page 28: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

What is the most basic logic statement?

An IF…THEN statement

Page 29: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Write a logic statement for this situation: when the dog eats the cookie, the player receives 100 points and earns an extra life

IF the dog eats a cookie, THEN add 100 to the player score AND add one to the number of player lives.

Page 30: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

Modify the previous logic statement to include sound in the game for the event

IF the dog eats a cookie, THEN add 100 to the player score AND add one to the number of player lives AND play a sound.

Page 31: 5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.

© Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only.

The Games Factory 2 is an object-oriented programming engine. How are the properties of an object changed?

The Properties window in The Games Factory 2 contains the properties for a selected object and is where those properties are changed.