interactive programming
Download
Skip this Video
Download Presentation
Interactive Programming

Loading in 2 Seconds...

play fullscreen
1 / 11

Interactive Programming - PowerPoint PPT Presentation


  • 223 Views
  • Uploaded on

Interactive Programming. MMP 220 Multimedia Programming.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Interactive Programming' - Albert_Lan


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
interactive programming

Interactive Programming

MMP 220

Multimedia Programming

The material in this handout is taken from “Learning to Program with Alice” a project supported by the National Science Foundation under Grant NSF-0126833, NSF-0302542, and NSF-0339734. Contact Wanda Dann: [email protected], Stephen Cooper: [email protected],

Randy Pausch: [email protected], and Don Slater: [email protected] http://www.aliceprogramming.net/

This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project funded by

National Science Foundation grant #0511209 Co PI’s Christopher Stein and Jody Culkin

BMCC CUNY http://teachingmultimedia.net

control of flow
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
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
Events
  • Each time the user provides some sort of input, we say an eventis generated.
    • An event is “something that happens”
event handling methods
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 behavioris created.
example
Example
  • Build an air show flight simulator. In an air show, the pilot uses biplane controls to perform acrobatic stunts.
problem
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
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
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
slide10
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.
assignment
Assignment

Read Chapter 5

ad