Determining When Two Objects Collide in a Turing Program

Slides:



Advertisements
Similar presentations
Using the diagram below, answer the following questions and then check your answers. Keep this diagram in your notes because you will be responsible for.
Advertisements

MODULE 10 Platforms. Data Representation Data Representation refers.
CHAPTER 6 Introduction to Graphing and Statistics Slide 2Copyright 2012, 2008, 2004, 2000 Pearson Education, Inc. 6.1Tables and Pictographs 6.2Bar Graphs.
Classification and Neural Networks. Consider On input +1 means Has got it 0 means unknown -1 Means hasn’t got it So Wings (+1), Beak(+1),Feathers(+1),
Systems of Linear Equations
HOW TO ADD INTEGERS REMEMBER:
10-2 Graphing Functions Learn to represent linear functions using ordered pairs and graphs.
In.  This presentation will only make sense if you view it in presentation mode (hit F5). If you don’t do that there will be multiple slides that are.
Fri 10/2 Lesson 2 – 8 Learning Objective: To graph two variable inequalities Hw: Pg. 118 #8 – 17, 39 – 41, *46.
Rational Functions Analysis and Graphing PART 1 Analysis and Graphing PART 1 Our Learning objective: Is to explore and explain why the denominator of.
Graphing Functions #33.
COMPUTER PROGRAMMING I SUMMER 2011 Objective 8.01 Understand coordinate systems. (3%)
24 Background Building 25 Computing Terminology, and Speed/Velocity Module 4 Notes: Sensing, Or Operator, Conditional Logic 28 Module 4 Algorithms,
Clipping Primitives. Clipping line Clipping rectangle: – x min to x max – y min to y max A point (x,y) lies within a clip rectangle and thus displayed.
Backpacks on chairs if they don’t fit on hangers.
VOCABULARY CHECK Prerequisite Skills 1. Draw a coordinate plane and label the x -axis, y - axis, origin, and Quadrant III. 2. In the inequality x ≥ 8,
Top view X-plane transmitter Y-plane transmitter Z-plane transmitter Fiber-optic Harness P.C. with WiFi wireless Battery Driver Receiver modules.
Sprite sets. project of the week: bubble popper o objects appear from the bottom and slide up o player needs to avoid objects to earn points (objects.
Unit 5 Transformations in the Coordinate Plane. Translations.
Graphing and Equations
Computer Graphics Lecture 14 CLIPPING I Taqdees A. Siddiqi
Systems of Linear Equations
Keyboard Input.
Transformations - Reflections
Lines that point down-hill have a negative slope.
Hidden Lines in Orthographic Drawings
Intro & Point-to-Box, Circle-to-Circle, Point-to-Circle
Collision Detection Box-to-Box.
Linear Inequalities b kevil.
Systems of Linear Equations
Systems of Linear Equations
Systems of Linear Equations
Activating Strategy: Watch the video clip below and write down a list of words to describe the motion that is occurring. Instructional Approach(s): The.
Activating Strategy: Watch the video clip below and write down a list of words to describe the motion that is occurring. Instructional Approach(s): The.
4.4 Analyzing Functions.
Computer Graphics Lecture 20
Activating Strategy: Watch the video clip below and write down a list of words to describe the motion that is occurring. Instructional Approach(s): The.
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
Systems of Linear Equations
Warm-Up 1. Put in slope-intercept form: 3x – 4y = -12
Solution Solution Checking Solutions of Inequalities
LECTURE 9.2 – ALTERING RATES
Example 1: Finding Solutions of Equations with Two Variables
FINISH a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f
3.1 Notes: Solving Systems of Equations
Objectives: 1. Graph Piecewise Functions 2
4.3B Analyzing Functions.
Polynomial Functions and Their Graphs
Boyle’s Law and Charles’ Law
Activating Strategy: Watch the video clip below and write down a list of words to describe the motion that is occurring. Instructional Approach(s): The.
Academic Presentation Making 12/12/17
Systems of Linear Equations
Activating Strategy: Watch the video clip below and write down a list of words to describe the motion that is occurring. Instructional Approach(s): The.
Transformation Geometry
Activating Strategy: Watch the video clip below and write down a list of words to describe the motion that is occurring. Instructional Approach(s):
Variables & getting info from the user
FINISH a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f
Systems of Linear Equations
Systems of Equations Solving by Graphing.
Unit 1 Transformations in the Coordinate Plane
Objective: Learn to compare the values of the fractions.
(Westhill Episcopal Educational Productions)
Sequential Circuit Analysis
4 minutes Warm-Up Solve and graph. 1) 2).
Warm-Up 1. Put in slope-intercept form: 3x – 4y = -12
(Westhill Episcopal Educational Productions)
Predicting Chance Outcomes
Unit 1 Transformations in the Coordinate Plane
Position in Scratch.
Translate, Rotate, Reflect!!!
Presentation transcript:

Determining When Two Objects Collide in a Turing Program Collisions Determining When Two Objects Collide in a Turing Program

Remember all references to the position of a sprite are based on the bottom left corner of the sprite. xPlane + Pic.Width(plane), yPlane + Pic.Height (plane) xPlane, yPlane + Pic.Height(plane) xPlane + Pic.Width(plane), yPlane xPlane, yPlane

A collision occurs when the two sprites “touch” A collision occurs when the two sprites “touch”. The computer determines this by comparing the coordinates of the spites and determining whether certain conditions are true (ie. whether the coordinates “cross” or “touch”). There are four ways one graphic can collide with another – from the top or bottom (y-coordinate of the sprites are compared) and from the left or right (x-coordinate of the sprites are compared).

yPlane < yBird + Pic.Height(bird) In the example below, the bird collides with the plane from the bottom. A collision occurs when the y-coordinate of the bottom of the plane sprite (yPlane) is less than the y-coordinate of the top of the bird sprite (yBird + Pic.Height(bird)). yPlane < yBird + Pic.Height(bird) yPlane > yBird + Pic.Height(bird)

yPlane + Pic.Height(plane) > yBird In the example below, the bird collides with the plane from the top. A collision occurs when the y-coordinate of the top of the plane sprite (yPlane + Pic.Height(plane)) is greater than the y-coordinate of the bottom of the bird sprite (yBird). yPlane + Pic.Height(plane) > yBird yPlane + Pic.Height(plane) < yBird

xPlane + Pic.Width(plane) > xBird In the example below, the bird collides with the plane from the right. A collision occurs when the x-coordinate of the right of the plane sprite (xPlane + Pic.Width(plane)) is greater than the x-coordinate of the left of the bird sprite (xBird). xPlane + Pic.Width(plane) > xBird xPlane + Pic.Width(plane) < xBird

xPlane < xBird + Pic.Width(bird) In the example below, the bird collides with the plane from the left. A collision occurs when the x-coordinate of the left of the plane sprite (xPlane) is less than the x-coordinate of the left of the bird sprite (xBird+ Pic.Width(plane)). xPlane < xBird + Pic.Width(bird) xPlane > xBird + Pic.Width(bird)

xPlane < xBird + Pic.Width(bird) In the example below, the bird does not collide with the plane from the right even though the y-coordinate of the left of the plane sprite (xPlane) is less than the y-coordinate of the right of the bird sprite (xBird + Pic.Width(bird)) when it finishes. Why? xPlane < xBird + Pic.Width(bird) xPlane > xBird + Pic.Width(bird)

In order for a collision to occur, all the conditions described in the previous slides must be true. The program must therefore have the following code to check for a collision: if yPlane < yBird + Pic.Height(bird) % Checks from bottom and yPlane + Pic.Height(plane) > yBird %Checks from top and xPlane + Pic. Width(plane) > xBird % Checks from right and xPlane < xBird + Pic.Width(bird) % Checks from left then