Detecting collisions Susan Ibach | Technical Evangelist

Slides:



Advertisements
Similar presentations
LECTURE LECTURE 12 Today: Friend functions / classes Textbook: p
Advertisements

Video Game Design Lesson 1. Game Designer Person involved in the development of a video game Person involved in the development of a video game Usually.
Game city International Starting on the road to programming. This project is all about learning how to program using scratch and other languages. The aim.
Computer Science Jan 2011 Robot Game. Introduction to Robot Arcade game Collect all of the items while avoiding the enemy (robot) Objectives More extensive.
CATCH SCRATCH! Programming from Scratch. Remember Scratch?
By Mr. Lee. Backgrounds The image that appears in the background (duh!). This might be a horizon, or clouds, trees and rainbows in the distance If you’re.
Game Maker Day 2 Making a Maze Game.
VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT.
User Input and Collisions COSC 315 Fall 2014 Bridget M. Blodgett.
CoderDojo Roscommon. Today's Ninja Challenge: Create a GhostBuster Game Like This.
Microsoft® Small Basic Collision Detection Estimated time to complete this lesson: 1 hour.
Game Maker Terminology
Game Maker – Getting Started What is Game Maker?.
Tank Game Part 3 of 6. Secondary Weapons and Pick ups Pick ups will appear randomly in the battle area and can be collected by driving into them. Each.
Susan Ibach | Technical Evangelist Sage Franch | Microsoft Student Partner.
Sage Franch | Technical Evangelist Susan Ibach | Technical Evangelist.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Sage Franch | Technical Evangelist Susan Ibach | Technical Evangelist.
Susan Ibach | Technical Evangelist Sage Franch | Technical Evangelist.
Review Scene Management (Scene, Layer, Director) Sounds Menus Sprites & Actions.
DAY 4. MAKING SOMETHING ‘JUMP’ Simple! Move it a certain amount ‘up’ Glide back to your original spot.
Susan Ibach | Technical Evangelist Sage Franch | Microsoft Student Partner.
Susan Ibach | Technical Evangelist Sage Franch | Technical Evangelist.
Kodu Tinkering. Today we are learning about: Kodu & Tinkering ●I can explore Kodu for myself.
FOP: Multi-Screen Apps
Sound and more Animations
MORE Genre Specific Physics
Scratch Animated Greeting Cards.
Collision Theory and Logic
Intro CS – Screens and Variables
2D Graphics and Animations in Unity 3D
Unity 2D: Step by Step, Part 4
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
Collision Theory and Logic
Background Shapes & Collision Resolution (Top-down and Side-scrolling)
Objects, Functions and Parameters
Game Engines By James Tedder.
Prepared by: Gina Kadri Shahd Abdulhaq Supervised by: Dr.Raed Al-Qadi.
Review Scene Management (Scene, Layer, Director) Sounds Menus
Handling errors try except
Introduction to Events
Make Decisions.
1C present continuous: be + verb + -ing
Introduction to TouchDevelop
PROJECT 13 DIGITAL PHOTOGRAPHY
HW2 EE 562.
ATCM 6317Procedural Animation
Introduction to Coding
Objective of the lesson
Procedural Animation Lecture 8: Particle systems
Space Shooter Tips.
Checking for Collisions: Using Functions in Alice
Remembering lists of values lists
Functions Christopher Harrison | Content Developer
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
1C present continuous: be + verb + -ing
Year 7 Programming Project - Design Notebook
The coordinate system Susan Ibach | Technical Evangelist
Making decisions with code
Week 1 - Introduction and Objects
Using the sensor Lesson 5.
I just want to say... I am very proud for being able to teach you this quad. Your presentations were good, and I know that you are under pressure because.
Using Exponents to Write Large Numbers
Using Exponents to Write Large Numbers
A Christmas Carol Act Two, Scenes 3 and 4.
MULTIPLICATION.
So you want to be a Game Designer
Animation Translation.
How to read from a file read, readline, reader
Presentation transcript:

Detecting collisions Susan Ibach | Technical Evangelist Sage Franch | Microsoft Student Partner

At the moment nothing happens when our hero hits an obstacle

How do we detect collisions between objects? Pseudo code: (the robot runs into an obstacle) Remove a life from the game. Sprite objects have a built-in collision detector! Why not “if robot->overlaps with(obstacle)”? -> scope of robot. Don’t do anything. (Just keep playing!) Needs to be checked “on every frame”.

But there’s a catch! Remember…sprite objects are rectangular! If the RECTANGLES overlap, then the sprites overlap. Overlap? Overlap? No! Yes!

Using “overlaps with”

Why am I losing multiple lives when I hit an obstacle? Remember we are checking to see if we overlap on EVERY frame Frame 1 Obstacle and hero overlap Remove 1 life Frame 2 Obstacle and hero overlap Remove 1 life

Think like a coder…

Your challenge Add code to remove a life if the hero hits an obstacle

Congratulations! You’re getting close!

Vocabulary and concepts Pseudo code: Literally, “fake” code, used to sketch out ideas in code without paying attention to the syntax. Sprite: a 2-D image or animation that is integrated into a larger scene. Collision detection: In TouchDevelop, a sprite is always a rectangle. Often, much of the rectangle is transparent. Two sprites collide when their rectangles overlap. “overlaps with”: A function on a sprite used to detect a collision with another sprite. E.g. obstacle->overlaps with(hero). This function should be checked on every frame.