Advanced Multimedia Development (AMMD) ::: 2004. Review – past few weeks Flash ActionScript Conditional Statements Loops Variable Type Conversion Logical.

Slides:



Advertisements
Similar presentations
Introduction to Programming using Matlab Session 2 P DuffourJan 2008.
Advertisements

1 Chapter Five Selection and Repetition. 2 Objectives How to make decisions using the if statement How to make decisions using the if-else statement How.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
1 CS101 Introduction to Computing Lecture 23 Flow Control & Loops (Web Development Lecture 8)
CS001 Introduction to Programming Day 3 Sujana Jyothi
Flash Workshop Flash Workshop :: Agenda  Introductions  Look at a few Flash Examples  Flash Web Sites  Flash Web Applications  Flash Games.
Program Design and Development
Copyright © 2012 Pearson Education, Inc. Chapter 4: Making Decisions.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
Kapi’olani Community College Art 258 Interface Programming II In-class Presentation Week 5A.
Guide To UNIX Using Linux Third Edition
Implementing Control Logic in C# Svetlin Nakov Telerik Corporation
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
An Introduction to Textual Programming
Week71 APCS-AB: Java Control Structures October 17, 2005.
Study Guide For Test Chapter 5, 6,& 7 Test is Friday, May 15th.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Programming & Scratch. Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Chapter 4: Making Decisions. Understanding Logic-Planning Tools and Decision Making Pseudocode – A tool that helps programmers plan a program’s logic.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 4: Making Decisions.
MS3304: Week 6 Conditional statements. Overview The flow of control through a script Boolean Logic Conditional & logical operators Basic decision making.
Making Decisions. 4.1 Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >= Greater than.
PROBLEM SOLVING & ALGORITHMS CHAPTER 5: CONTROL STRUCTURES - SELECTION.
A Simple Quiz: Ask User Functions. By Lana Dyck under the direction of Professor Susan Rodger Duke University June 2009, added Part 2 July 2011.
1 COMS 261 Computer Science I Title: C++ Fundamentals Date: September 21, 2005 Lecture Number: 10.
1 Week 6 Branching. 2 What is “Flow of Control”? l Flow of Control is the execution order of instructions in a program l All programs can be written with.
Conditional Statement Chapter 8. Conditional Statements Are statements that check an expression then may or may not execute a statement or group of statement.
Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 7 Conditionals and Loops 4/18/09 Python Mini-Course: Day 2 - Lesson 7.
Software Engineering Principles Dr. José M. Reyes Álamo.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 4: Making Decisions.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Xiaojuan Cai Computational Thinking 1 Lecture 8 Loop Structure Xiaojuan Cai (蔡小娟) Fall, 2015.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
Using Control Structures. Goals Understand the three basic forms of control structures Understand how to create and manage conditionals Understand how.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
COMP Loop Statements Yi Hong May 21, 2015.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 4: Making Decisions 1.
Lecture 6 – Selection FTMK, UTeM – Sem /2014.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
While loops. Iteration We’ve seen many places where repetition is necessary in a problem. We’ve been using the for loop for that purpose For loops are.
CONDITIONALS CITS1001. Scope of this lecture if statements switch statements Source ppts: Objects First with Java - A Practical Introduction using BlueJ,
IST 210: PHP Logic IST 210: Organization of Data IST2101.
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
CHAPTER 4 DECISIONS & LOOPS
CHAPTER 10 JAVA SCRIPT.
ActionScript Basics 2016 (2.0 – 3.0)
Chapter 4: Making Decisions.
Chapter 4: Making Decisions.
Chapter 6: Conditional Statements and Loops
Expressions and Control Flow in JavaScript
JavaScript: Control Statements.
IF if (condition) { Process… }
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
During the last lecture we had a discussion on Data Types, Variables & Operators
Patterns to KNOW.
Design and Implementation
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Computer Science Core Concepts
Lesson 3. Controlling program flow. Loops. Methods. Arrays.
Presentation transcript:

Advanced Multimedia Development (AMMD) ::: 2004

Review – past few weeks Flash ActionScript Conditional Statements Loops Variable Type Conversion Logical Operators Project 1 Marking Scheme Program Design Simple Game: Mouse Chaser Review – past few weeks Flash ActionScript Conditional Statements Loops Variable Type Conversion Logical Operators Project 1 Marking Scheme Program Design Simple Game: Mouse Chaser ActionScript & Program Design

Flash Structure - Lecture Flash Animation Examples - Lecture Basic ActionScript - Lecture Storyboarding – Tutorial Program Design – Tutorial Lots of Flash Animation – Lab Basic ActionScript – Lab Project 1 – Apply => Flash Environment Start ActionScript Game Programming Flash Structure - Lecture Flash Animation Examples - Lecture Basic ActionScript - Lecture Storyboarding – Tutorial Program Design – Tutorial Lots of Flash Animation – Lab Basic ActionScript – Lab Project 1 – Apply => Flash Environment Start ActionScript Game Programming Review – past few weeks

Conditional Statements The if.. else.. conditional Real life (game) situation is full of if..else.. Situations (ask for example) myNumber = 10; if (myNumber >20) { trace ("myNumber is greater than 20"); } else { trace("myNumber is less than or equal to 20"); } The if.. else.. conditional Real life (game) situation is full of if..else.. Situations (ask for example) myNumber = 10; if (myNumber >20) { trace ("myNumber is greater than 20"); } else { trace("myNumber is less than or equal to 20"); }

Nested Conditional Put if statement inside a code block associated with another if statement myNumber = 10; if (myNumber <20) { trace("myNumber is less than 20"); if (myNumber <10) { trace("myNumber is less than 10"); } Put if statement inside a code block associated with another if statement myNumber = 10; if (myNumber <20) { trace("myNumber is less than 20"); if (myNumber <10) { trace("myNumber is less than 10"); }

Conditional - Switch The switch statement A elegant way to string together a series of if.. MyNumber = 2; switch (MyNumber) { case 1 : trace("case 1 tested true"); break; case 2 : trace("case 2 tested true"); break; case 3 : trace("case 3 tested true"); break; default : trace("no case tested true"); } The switch statement A elegant way to string together a series of if.. MyNumber = 2; switch (MyNumber) { case 1 : trace("case 1 tested true"); break; case 2 : trace("case 2 tested true"); break; case 3 : trace("case 3 tested true"); break; default : trace("no case tested true"); }

Loops – while Loop Real life (game) situation is full of while loops (ask for example) myNumber = 1; while (myNumber<10) { trace(myNumber); myNumber++; } Real life (game) situation is full of while loops (ask for example) myNumber = 1; while (myNumber<10) { trace(myNumber); myNumber++; }

Loops – for Loop for loop is a variation on the while loop for (myNumber=0; myNumber<10; myNumber=myNumber+1) { trace(myNumber); } for loop is a variation on the while loop for (myNumber=0; myNumber<10; myNumber=myNumber+1) { trace(myNumber); }

Variable Type Conversion When a variable of one type is used where a variable of a different type is expected, Flash does an automatic type conversion. Example: non-zero = true, 0 to false Number to Boolean if (-102.4) trace ("this will print"); if (50326) trace ("this will print"); if (0) trace ("this will NOT print"); When a variable of one type is used where a variable of a different type is expected, Flash does an automatic type conversion. Example: non-zero = true, 0 to false Number to Boolean if (-102.4) trace ("this will print"); if (50326) trace ("this will print"); if (0) trace ("this will NOT print");

Variable Type Conversion Flash does an automatic type conversion. Number to String myResult1="Hello" ; myResult2= "hello" ; trace(myResult1); trace(myResult2); Flash does an automatic type conversion. Number to String myResult1="Hello" ; myResult2= "hello" ; trace(myResult1); trace(myResult2);

Logical Operators AND Operator => && OR Operator => || NOT Operator => ! myNumber = 25; if (myNumber >= 20 && myNumber <=30) { trace("in range"); } myNumber = 35; if (myNumber 30) { trace("out of range"); } AND Operator => && OR Operator => || NOT Operator => ! myNumber = 25; if (myNumber >= 20 && myNumber <=30) { trace("in range"); } myNumber = 35; if (myNumber 30) { trace("out of range"); }

Logical Operators Precedence && has higher precedence than ||, so all && will be evaluated first trace (true && false || true && true); trace (true || false && true || true); trace (true && true && true || true); trace (true || false && false); && has higher precedence than ||, so all && will be evaluated first trace (true && false || true && true); trace (true || false && true || true); trace (true && true && true || true); trace (true || false && false);

Project 1 Submission will be next week lab session Marking Scheme (minor changes) Show example again Submission will be next week lab session Marking Scheme (minor changes) Show example again

Program Design A program is a set of instructions written so the computer can follow them. Program Development Cycle It is about planning…  Poor planning is damaging  Planning saves time  Good program design makes coding simple  Cool… A program is a set of instructions written so the computer can follow them. Program Development Cycle It is about planning…  Poor planning is damaging  Planning saves time  Good program design makes coding simple  Cool…

Program Development Cycle Review the specification Informal Design List major tasks List subtasks, sub-subtasks, so on Formal Design Create formal design from tasks list Desk check design Code and compile program Test and Debug the program Use and maintain the program Review the specification Informal Design List major tasks List subtasks, sub-subtasks, so on Formal Design Create formal design from tasks list Desk check design Code and compile program Test and Debug the program Use and maintain the program

Mouse Chaser Show game Mouse Chaser The Coordinates System Show game Mouse Chaser The Coordinates System 0,0 0, MaxY MaxX, 0 MaxX, MaxY + X + Y

Mouse Chaser Review the specification Informal Design List major tasks List subtasks, sub-subtasks, so on Formal Design Create formal design from tasks list Desk check design Code and compile program Test and Debug the program Use and maintain the program Review the specification Informal Design List major tasks List subtasks, sub-subtasks, so on Formal Design Create formal design from tasks list Desk check design Code and compile program Test and Debug the program Use and maintain the program

Mouse Chaser Review the specification Idea Write design document etc… Not to cover for this lecture This lecture shows… List major tasks List subtasks, sub-subtasks, so on … Coding Review the specification Idea Write design document etc… Not to cover for this lecture This lecture shows… List major tasks List subtasks, sub-subtasks, so on … Coding

Mouse Chaser Major Tasks Obtain Art Script Organization Bat chases (follows) the user’s mouse pointer, If Bat reaches pointer,... Target when clicked, move randomly … Major Tasks Obtain Art Script Organization Bat chases (follows) the user’s mouse pointer, If Bat reaches pointer,... Target when clicked, move randomly …

Mouse Chaser Major task: Obtain Art Subtasks: The critter The critter’s home The mouse pointer The target The score display Show “mouse chaser unfinished.fla” Major task: Obtain Art Subtasks: The critter The critter’s home The mouse pointer The target The score display Show “mouse chaser unfinished.fla”

Mouse Chaser Major task: Script Organization Subtasks: Frame 1 Frame Script to control the game Instance Scripts attached to instances Develop line of communication between different pieces of scripts Show “mouse chaser.fla” the finished file’s code structure Major task: Script Organization Subtasks: Frame 1 Frame Script to control the game Instance Scripts attached to instances Develop line of communication between different pieces of scripts Show “mouse chaser.fla” the finished file’s code structure

Mouse Chaser Major tasks: Bat chases the user’s mouse pointer Subtasks Move the bat Test to see if the bat has caught the mouse If the mouse has been caught, test for a high score reset the score reset the speed move the bat home Show “mouse chaser major 1.fla” Major tasks: Bat chases the user’s mouse pointer Subtasks Move the bat Test to see if the bat has caught the mouse If the mouse has been caught, test for a high score reset the score reset the speed move the bat home Show “mouse chaser major 1.fla”

Mouse Chaser Major tasks: Target when clicked, move randomly Subtasks: Increase the score Increase the speed Move the bat home Move the target randomly Show “mouse chaser major 2.fla” Major tasks: Target when clicked, move randomly Subtasks: Increase the score Increase the speed Move the bat home Move the target randomly Show “mouse chaser major 2.fla”

Conclusion That’s how to start to code a game