Game Rules Implementation Lecture 5 1. Revisit 2  Lab 4 – Other Input Methods  Touches Basics  Relationship between TouchesBegan, TouchesMoved, and.

Slides:



Advertisements
Similar presentations
View-Based Application Development Lecture 1 1. Flows of Lecture 1 Before Lab Introduction to the Game to be developed in this workshop Comparison between.
Advertisements

Mouse Tutorial for Win XP In this tutorial you will learn to: Move the mouse Click and double click Make selections Manage windows Use menus Click the.
5 Collision Theory and Logic © Goodheart-Willcox Co., Inc. Permission granted to reproduce for educational use only. Use game design software to create.
Introduction Games have always been a fundamental part of human life. Space storm “ عاصفة الفضاء” is a 3D SCI-FI game that consists of two stages presented.
A Level Computing#BristolMet Session Objectives#U2 S2 MUST describe the steps of an algorithm using a program flowchart SHOULD explain the data types and.
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.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Animation Pre-Lab Lecture 3 1. Revisit 2  Pre-Lab 2  Create new UI components through codes  Too many UI components that are required to put on the.
Intro to Game Development An introduction to Swing, Java2D, JOGL, and game design Created by: Dennis Lawter and Dustin Scott.
Index Project Introduction Requirement Analysis Architectural Description Progress and Technical Challenges Further Plans.
Programming games Reprise on dice game and alternative dice game Homework: [Catch up.]. Finish dice game.
Asteroids Games and Simulations O-O Programming in Java The Walker School The Walker School – Games and Simulations
Other Input Methods Pre-Lab Lecture 4 1. Revisit 2  Pre-Lab 3 – Animation  Boundary Information  Layer Concept  Animation algorithm  Next Position.
Touches Detection and Other Remaining Parts Lecture 3 1.
UIAlertView, UIActionSheet, and Facebook Connection Lecture 4 1.
CS 282.  Questions about Assignment 1?  Questions about last week’s lab?  Otherwise, please sit next to your partner (or someone else if your partner.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Designing Algorithms Csci 107 Lecture 3. Administrativia Lab access –Searles 128: daily until 4pm unless class in progress –Searles 117: 6-10pm, Sat-Sun.
A Scratch tutorial. Description: You have 6 bullets to shoot at 2 targets. Every time you hit any of them you get two extra bullets but the targets get.
Creating Mobile Apps with App Inventor! Day 5 Google search Kris Gordon Ludlow for links.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
Introduction to TouchDevelop
Game Maker Day 2 Making a Maze Game.
Microsoft PowerPoint Getting Started Guide Prepared for Towson University Dr. Jeff M. Kenton Amy Chase Martin 2007.
CSE 380 – Computer Game Programming Sprite Animation
Visual Basic Games: Prepare for Hangman
Lecture #26 Digital Video Editing II. Movie Editing Software iMovie Windows Live Movie Maker 2011 ( Adobe.
KeyListener and Keyboard Events Just as we can implement listeners to handle mouse events, we can do the same for keyboard events (keypresses) –to implement.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
Alice Pong Recreating Pong in Alice By Elizabeth Liang under the direction of Professor Susan Rodger Duke University June 2010.
GDT Development Tutorial. GDT Development Tutorial Doug Evans and Detlef Lexut GDT 2008 International User Conference August 10 – 13  Lake Las Vegas,
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 2 "The games of a.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
Control Structures II Repetition (Loops). Why Is Repetition Needed? How can you solve the following problem: What is the sum of all the numbers from 1.
Neo-Breakout Sonhui Schweitzer CS 470 Spring 2005.
Microsoft® Small Basic Collision Detection Estimated time to complete this lesson: 1 hour.
Game Maker Terminology
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
“The perfect project plan is possible if one first documents a list of all the unknowns.” Bill Langley.
Implementing Subprograms What actions must take place when subprograms are called and when they terminate? –calling a subprogram has several associated.
Final Project Proposal Space Invaders By Jordan Mahaffey.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Hashing CS 110: Data Structures and Algorithms First Semester,
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 5 Objectives  Learn about basic GUI components.  Explore how the GUI.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
1 UI Alert View iPhone/iPad, iOS Development Tutorial.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Action Script 12 "The games of a people.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
Today we are learning to: Understand how flow charts are used to design games Add events to our objects to control stuff in our game – (Using the user.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
11 Debugging Programs Session Session Overview  Create and test a method to calculate percentages  Discover how to use Microsoft Visual Studio.
ROBOTC Software EV3 Robot Workshop
Galactic Mail Part 2. Winning and Losing Exploding Asteroids Including Scoring Adding Levels And more.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
CS 200 Multimedia Objects in Web Pages. MultiMedia Objects Three primary types of multimedia objects  Audio  Video Includes Flash Objects  Images.
GAME:IT Paddle Ball Objectives: Review skills from Introduction Create a background Add simple object control (up and down) Add how to create a simple.
The Stingray Example Program CMT3311. Stingray - an example 2D game May be useful as a simple case study Most 2D games need to solve generic problems.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
Animation & Games Module
Game Loop Update & Draw.
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
Creating a Simple Game in Scratch
Presentation transcript:

Game Rules Implementation Lecture 5 1

Revisit 2  Lab 4 – Other Input Methods  Touches Basics  Relationship between TouchesBegan, TouchesMoved, and TouchesEnded  Getting Touch Point on screen  Handling MultiTaps and MultiTouches  Touches Actions and Gestures  Dragging on UserImage  Moving to change orientation of the userImage  Tilting Devices  Accelerometer Reading Basics  Tilting devices to move the userImage

Tutorial 5 Overview of Lab 5 3 INPUT PROCESSOUTPUT Collision Detection Game End Condition Part 1 Part 2 Part 3

Missing Parts of the Game 4  Collision Detection  This is necessary to detect whether various animating images collide with each other, so as to determine scores and allow the game to progress  Part 1: Whether the balloons collide with the userImage  Part 2: Whether the balloons collide with the bullets  Game End Condition  This is necessary to determine when the game should end

Common Collision Technique I 5  Each image object is treated as a circle with a radius on the screen  The radius can be approximated by width/2 or height/2  If the sum of the radius of two objects is less than the distance between their center positions  Then, the two objects are considered to be collided.  To simplify your work, you can add the following method to the view controller to check whether two objects collide  -(bool) collide : (float) x1 : (float) y1 : (float) r1 : (float) x2 : (float) y2 : (float) r2 {  float centerDistance = sqrt(pow((x1-x2),2) + pow((y1-y2),2));  return (centerDistance < (r1 + r2));  }

Collision Detection Technique II 6 Radius of Balloon Distance between userImage and balloon Radius of user Image Not Collide Collide

Part 1: Whether Balloons Collide with UserImage Algorithm 7  For each target balloon, check whether it collides with userImage  If yes,  Remove it from targetDataArray and targetImageArray  Generate enough targets so that the total number of targets is still DEFAULT_TARGET_NUM_ON_SCREEN

Issue on Forward Traversing the Targets Data or Image Array 8  Maybe we can consider the following situation:  We have a target data Array of 5 elements  If target collides with the userImage  The corresponding target is removed from the array Original Index Original Target Array Original Index New Target Array New Index Index Traverse Not considered

Backward Traverse 9  Again, the conditions are the same as before, but we traverse the array from backward direction Original Target Array Original Index New Target Array New Index Index Traverse Considered

Part 2: Whether the balloons collide with the bullets Algorithm I 10  For each bullet,  For each target, check whether it collides with the target  If yes,  Check if it is the current target  If yes,  Update targetsLeft and targetsShot  Update current target and next target  Remove the bullet and balloon  Generate a new balloon

Part 2: Whether the balloons collide with the bullets Algorithm II 11  Basically, the algorithm here is very similar to that of Part 1  Except  Need to consider the traverse on two arrays  Need to update the scores shown on the screen  Need to update the current target window and next target window  Does forward traverse issue occur in this case? Why?  How can we solve it?

Part 3 – Game End Conditions 12  When you first design the game, you must have designed the game objective  In this game, our objective is to shoot a certain amount of targets shown on the current target window within a certain time limit  We can see from the objective that  Winning Condition – Shoot a certain amount of targets before time end  Losing Condition – time up  When the game end, we should  Stop the timer and reset the accelerometer  Display a message to show whether you win or lose

Display a Pop up window 13  In iPhone, you can display a pop up window to alert the user with some special event.  This is known as UIAlertView  // First of all, we have to initiate an UIAlertView object with the associated title and message.  // Here, we also set it to show one button only  UIAlertView * av = [[UIAlertView alloc] Ended” Up !!! Please try again” delegate:self otherButtonTitles:nil, nil, ni];  // The alertView is pop up  [av show];  // Since it has already been pop up, we can release the memory used to hold the alert view  [av release];

Display when game ended 14

Part ∞: Challenges 15  Introduce sound effects, such as, balloon “pops” when hit by a bullet  Note that two sound files are provided  Different difficulty levels  Keeping best score  Multiplayer game, etc.  Other interesting game rules?

Q & A 16