Fall 2007ACS-1805 Ron McFadyen1 Chapter 5 Interactive Programs.

Slides:



Advertisements
Similar presentations
Sprite-visual object (actor on the stage) Scripts- Tells actors (sprites) what to do.
Advertisements

Events in Alice By Henry Qin, edited by Jenna Hayes under the direction of Professor Susan Rodger Duke University, August 2008.
PIIT Computer Science Summer Camp - Alice July 11, 2012 Brenda Parker Computer Science Department MTSU.
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 and Event-Handler Methods Alice. Mouse input Interactive programs often allow the user to use a mouse to click buttons in a windows-based interface.
Fall 2007ACS-1805 Ron McFadyen1 Ch 7 Loops Alice has two control structures for controlling the repeated execution of statements Loop While.
Parameters and Event-Handler Methods Sec 50 Web Design.
Fall 2008ACS-1805 Ron McFadyen1 ACS-1805 Introduction to Programming using Alice 2.0 Ron McFadyen Course OutlineMcFadyenOutline.
Fall 2008ACS-1805 Ron McFadyen1 Ch 8 Recursion Recursion occurs when a method (or function) calls itself.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 7 Repetition.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 3 Programming - Putting Together the Pieces.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 8 Recursion.
Fall 2009ACS-1805 Ron McFadyen1 ACS-1805 Introduction to Programming using Alice.
CS320n –Visual Programming Interactive Programs Mike Scott (Slides 5-1)
Fall 2007ACS-1805 Ron McFadyen1 Chapter 4 OO Programming Concepts.
Interaction: Events and Event Handling
Fall 2007ACS-1805 Ron McFadyen1 Chapter 6 Functions & If/Else.
Graphical User Interfaces A Quick Outlook. Interface Many methods to create and “interface” with the user 2 most common interface methods: – Console –
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
Study Guide For Test Chapter 5, 6,& 7 Test is Friday, May 15th.
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.
Chapter 8: Writing Graphical User Interfaces Visual Basic.NET Programming: From Problem Analysis to Program Design.
Events Chapter 7 Part 2. While a Key is Pressed Event Specialized event An event occurs when you press a key and continues until you take your finger.
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.
Parameters and Event-Handler Methods Alice. Mouse clicks Interactive programs often allow the user to mouse click an object in the display. buttons in.
Parameters and Event-Handler Methods MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Lab 6: event & input intro User Interface Lab: GUI Lab Oct. 2 nd, 2013.
Interactive Programming Sec 49 Web Design. Objectives The student will: Understand the difference between movie mode and an interactive program Understand.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
What is Programming? Computer programming is about telling the computer what it is we want it to do We tell the computer what we want it to do by sending.
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,
CompSci 4 Chap 5 Sec 2 Oct 18, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
CS320n – Elements of Visual Programming Sending Parameters to Event Handler Methods (Slides 5-2) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
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.
CompSci 4 Chap 5 Sec 2 Oct 9, 2008 Prof. Susan Rodger.
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.
Fall 2008ACS-1805 Ron McFadyen1 Event-driven programming Chapter 5 covers event-driven programming. Events are user or condition driven and so each event.
CompSci 4 Chap 5 Sec 1 and 2 Oct 14, 2010 Prof. Susan Rodger.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
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.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Parameters and Event-Handler Methods
Starting Out with Alice: A Visual Introduction to Programming
Event-driven programming
Chapter 8: Writing Graphical User Interfaces
Introduction to Events
Parameters and Event-Handler Methods
Interactive Programming
Graphical User Interfaces in Java Event-driven programming
Parameters and Event-Handler Methods
Parameters and Event-Handler Methods
ICT Programming Lesson 5:
Chapter 13: Handling Events
Event-driven programming
Parameters and Event-Handler Methods
Interactive Programming
Presentation transcript:

Fall 2007ACS-1805 Ron McFadyen1 Chapter 5 Interactive Programs

Fall 2007ACS-1805 Ron McFadyen2 Events We say an event occurs when something significant happens. Alice provides for handling many different kinds of events … examine the upper right hand pane of the Alice interface. Notice that we have been using the first event type in all of our programs

Fall 2007ACS-1805 Ron McFadyen3 Events Each event is paired with an event-handling method By default when the world starts is associated with my first method

Fall 2007ACS-1805 Ron McFadyen4 Events User-generated events can defined for when the user clicks the mouse or types a key on the keyboard. This allows for interactive programs … methods will execute in accordance with user input.

Fall 2007ACS-1805 Ron McFadyen5 Parameters Methods may be defined with parameters. Certain events (e.g. mouse click) are associated with an object and can be useful for setting up values to be passed as parameter values. Text example 1: use clicks on a person to be saved by a fire truck. The person object, the floor they are standing on, and the distance are passed to the method. One event-handling method works for all 3 objects.

Fall 2007ACS-1805 Ron McFadyen6 Parameters Text example 2: Simulation of a Greek Tragedy The storyboard is more complicated… the event handler calls three other methods. Because the method is directing all the action for the user click, it is referred to as a driver Using a driver is a common technique for organizing complexity… a common outcome of stepwise refinement.

Fall 2007ACS-1805 Ron McFadyen7 Tips/Techniques Events When the world starts… we have always used this one When a key is typed… chapter 5 When the mouse is clicked on something… chapter 5 While something is true… see chapter 7 When a variable changes … see chapter 10 Let the mouse move … event handler exists in Alice Let the arrow keys move … event handler exists in Alice Let the mouse move the camera … event handler exists in Alice Let the mouse orient the camera… event handler exists in Alice Take care with these – you may end up seeing nothing User can move objects about