Interactive Programming Sec 49 Web Design. Objectives The student will: Understand the difference between movie mode and an interactive program Understand.

Slides:



Advertisements
Similar presentations
PIIT Computer Science Summer Camp - Alice July 11, 2012 Brenda Parker Computer Science Department MTSU.
Advertisements

Alice Inheritance and Event Handling. Inheritance Concept Consider this hierarchy; parents describe properties of children Animals Vertebrates MammalsFish.
Events Chapter 7. Interactivity The real world is interactive User determines order of actions instead of programmer.
Events Chapter 7. Interactive Real world is interactive User determines order of actions instead of programmer.
Parameters Section 8-8 Web Design. Objectives The student will: Understand what a parameter is Understand how to use a parameter in Alice Understand how.
Introduction to Alice Alice is named in honor of
Parameters and Event-Handler Methods Sec 50 Web Design.
Lights Camera Action! Part 3: BDE Events By Deborah Nelson under the direction of Professor Susan Rodger Duke University July 2008.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 5 Interactive Programs.
Exploring Events. Try this Start Alice and create a blank world using the grass template. Add an instance of a BlueBallerina. Add an instance of a PinkBallerina.
Introduction to Alice Basics : What is Alice? Object Oriented Definitions What Does it Look Like? Where Can I Use it?
Fall 2009ACS-1805 Ron McFadyen1 ACS-1805 Introduction to Programming using Alice.
CS320n –Visual Programming Interactive Programs Mike Scott (Slides 5-1)
Interaction: Events and Event Handling
Alice 2.0 Introduction to Event-Driven Programming Mr. Planck.
Introduction to Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
COM 205 Multimedia Applications
Event-driven programming. Most modern computer programs that people use have Graphical User Interfaces (GUIs). A GUI has icons on the computer screen.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley This week: Whew!!! The last homework was tough! The homework for this week.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
Execution Control with If/Else and Boolean Functions
CSC1401: Introductory Programming Steve Cooper
CompSci 4 Chap 5 Sec 1 Oct 13, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
Study Guide For Test Chapter 5, 6,& 7 Test is Friday, May 15th.
Alice: Functions Alice Chapter 6 September 19, 2005.
Interaction: Events and Event Handling
Parameters and Event-Handler Methods Sec 50 Web Design.
Review For Test Chapter 4 & 5 Test is Wednesday, January 27th.
Event Driven Programming Chapter 5. Sequential Programming Computer-Centric Computer-Centric Program Runs as Programmer Intended Program Runs as Programmer.
Events (2) (Alice In Action, Ch 6) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September 2012.
Today’s Agenda 1.Collect Pre-Lab 5 2.Collect Alice project storyboards 3.Events 4.Dummy Objects 5.Assign pair programming teams and meet upstairs for Lab.
Variables and Inheritance A More Complex Example Alice.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
Events (Alice In Action, Ch 6) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September 2012.
Buttons and Birds: Introduction to Interactive Events in Alice By Henry Qin, edited by Jenna Hayes under the direction of Professor Susan Rodger Duke University,
Unit 3 Music and Sound Evangel College S.2 ICT.
Introduction to Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
Functions Sec 8-11 Web Design. Objectives The Student will: Understand what a function is Know the difference between a method and a function Be able.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Introduction to Alice Web Design Section 8-2 Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Today we are learning to: Understand how actions and events control our game. Completing the catch the clown game – making a room – adding music Gather.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
Chapter 5 Interaction: Events and Event Handling.
Repetition: Definite Loops Sec 53 Web Design. Objectives The Student will: Understand loops and why they are used Understand definitive loops Know how.
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
Interactive Programming MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project.
Programming: Simple Control Structures Sec 46 Web Design.
Fall 2008ACS-1805 Ron McFadyen1 Event-driven programming Chapter 5 covers event-driven programming. Events are user or condition driven and so each event.
Copyright © 2003 Pearson Education, Inc. Chapter 4 – Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
CompSci 4 Chap 5 Sec 1 and 2 Oct 14, 2010 Prof. Susan Rodger.
Lesson 8C Animation and Events. Step 3: Animation Drag it into the method and have him say “let her go!” Click on the knight in the object tree and scroll.
CS320n –Visual Programming Execution Control with If / Else and Boolean Functions (Slides 6-2-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
Variables and Inheritance Part 1 Alice. Review: Properties A class defines properties for its own kind of object. When an object is created (instantiated),
Parameters Section 8-8 Web Design.
Functions Sec 51 Web Design.
Starting Out with Alice: A Visual Introduction to Programming
Event-driven programming
Programming: Simple Control Structures
Functions Sec 8-11 Web Design.
Lesson 1: Buttons and Events – 12/18
Introduction to Events
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Interactive Programming
Event-driven programming
Interactive Programming
Variables and Inheritance A More Complex Example
Presentation transcript:

Interactive Programming Sec 49 Web Design

Objectives The student will: Understand the difference between movie mode and an interactive program Understand what an “event” is Understand how to add an event handling to your Alice program

Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what happens next, and then what happens…and so on. In movie-style programs (Chapters 1-4) the sequence of actions is determined by the programmer Creating a storyboard design Writing program methods to carry out the designed sequence

Interactive Animations In interactive programs, the sequence of actions is determined at runtime when the user provides input clicks the mouse presses a key on the keyboard some other source of input In essence, control of flow is now “in the hands of the user!”

Events Each time the user provides some sort of input, we say an event is generated. An event is “something that happens”

Event Handling methods An event may Trigger a response, or Move objects into positions that create some condition (e.g., a collision) that triggers a response. A method is called to carry out the response. We call this kind of method an event handling method. When an event is linked to a method that performs an action, a behavior is created.

Example Build an air show flight simulator. In an air show, the pilot uses biplane controls to perform acrobatic stunts.

Problem The whole idea in a flight simulator is to allow the user to control the flight path. The problem is: how do we write our program code to provide a guidance system that allows the user to be the pilot?

Solution Use keyboard input Up-arrow key to move the biplane forward Spacebar to make the biplane do a barrel turn (Note: other sets of keys could be used, we just arbitrarily picked a couple of keys on the keyboard.) Write event handler methods that respond to each key press

Storyboards Since two keys are used, two events are possible – so two storyboards are needed: Each storyboard outlines an event handler that responds to a particular event. Event: Spacebar press Response: Do together roll biplane a full revolution play biplane engine sound Event:: Up Arrow key press Response: Do together move biplane forward play biplane engine sound

Demo Ch05Lec1BiplaneAcrobat Concepts illustrated: Events are created in the event editor A method is called to handle each event Synchronize the duration of the animation with the length of a sound. To change the length of a sound, use audio editing software.

Summary Events are triggered by user inputs Event allow the user to control how the program reacts Event handling methods are methods that are called when triggered by an event.

Rest of Today Read Chapter 5-1 Interactive Programming Download Chapter 5 sec 1 questions Do one of the two the chapter 5-1 exercises Complete the questions