Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

Lesson 5+: Using He- Builder/She-Builder And Adding Text! Slides are adapted from aliceprogramming.net or
Objectives © Paradigm Publishing, Inc. 1 Objectives.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
PIIT Computer Science Summer Camp - Alice July 11, 2012 Brenda Parker Computer Science Department MTSU.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
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.
Using Macros and Visual Basic for Applications (VBA) with Excel
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
PowerPoint Chapter 2 Review
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create Presentation Open, Save, Run, Print, Close,Delete.
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.
Microsoft Office Illustrated Inserting Illustrations, Objects, and Media Clips.
CS320n –Visual Programming Interactive Programs Mike Scott (Slides 5-1)
Alice Learning to program: Part 1 Scene Setup and Starting Animation by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
1 Introduction to Human Computer Interaction  Livecode Overview  Based on Livecode User Guide from RunRev Ltd. (2010) 
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
Distributing (Fun + Learning): The Distributive Property By: Peggy Li Under the direction of Professor Susan Rodger Duke University, June
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running o Stored in.
Distributing (Fun + Learning): The Distributive Property By: Peggy Li Under the direction of Professor Susan Rodger Duke University, June 2011.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley This week: Whew!!! The last homework was tough! The homework for this week.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Record & run a macro Record & run a macro Save as a macro-
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Study Guide For Test Chapter 5, 6,& 7 Test is Friday, May 15th.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Interaction: Events and Event Handling
Review For Test Chapter 4 & 5 Test is Wednesday, January 27th.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 27 - Phone Book Application Introducing Multimedia.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Chapter 4 Creating a Custom Publication from Scratch Microsoft Publisher 2013.
Microsoft Publisher 2010 Chapter 1 Creating a Flyer.
Copyright 2007 Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Create a Chart with Data in a Worksheet Create a Chart.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running Types of data.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Learning to Program: Part 1 Scene Setup and Starting Animation by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke University,
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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Excel Chapter 1 Creating a Worksheet and an Embedded Chart
Introducing Scratch Learning resources for the implementation of the scenario
An Introduction to Programming with Alice Text and Sound in Alice Worlds.
Starting Out with Alice: A Visual Introduction to Programming
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
The Alice Interface.
Introduction to Events
Presentation transcript:

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition by Tony Gaddis Chapter 11: Events

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-2 Chapter 11 Objectives To understand: –what an event is and how to specify what type of event can be used –how to specify a different method to be executed when the world starts –the components of a BDE event

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-3 Today’s Agenda 1.Responding to Events 2.Handling Key Press and Mouse Events 3.Using Events in Simulations and Games 4.Tips for Games and Simulations

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-4 Responding to Events Event –Action that take place while a world is playing –Alice worlds detect events and respond to them –For example: when a user clicks an object with a mouse…it’s an EVENT! when a user types a key on the keyboard…it’s an EVENT! 6.1

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-5 Alice Events Process of responding to an event is called handling the event Tile for an event MUST appear in the Events Editor When world is first created, the event when the world starts appears in the Events Editor 6.1

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-6 Alice Events Most event tiles require that additional arguments be specified The method that is executed in response to the event is called the event handler 6.1

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-7 Alice Events When the world starts While the world is running When a key is typed While a key is pressed When the mouse is clicked on something While the mouse is pressed on something While something is true When something becomes true When a variable changes Let the mouse move Let the arrow keys move let the mouse move the camera Let the mouse orient the camera 6.1

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-8 Specialized Events Some events from the previous list do not appear in the Events Editor –General event must first be created –Right-click and select change to Changes an event to a specialized event 6.1

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-9 Handling Key Press and Mouse Events Alice can detect when a key on the keyboard has been pressed Key Press Events (such as when a key is typed) –The event is triggered when the user types a key –Key that will trigger the event must be specified –any key is the placeholder until the “real” key is selected 6.2

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-10 Handling the While a key is pressed Event The event occurs as long as the user holds down a key This tile has four different placeholder slots: –any key –Begin –During –End Known as BDE event 6.2

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-11 BDE Event Begin –Specifies an action to take place at the beginning During –Specifies an action to take place during the event End –Specifies an action to take place at the end (when the event stops occurring) 6.2

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-12 Mouse Events / While the mouse is clicked… When the mouse is clicked on something Event is triggered when the mouse is clicked on an object in the world While the mouse is clicked on something Event occurs as long as the user holds down the mouse button while the pointer is positioned over an object 6.2

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-13 Using Events in Simulations and Games Programs can have numerous events –They respond to various user interactions and internal events –Note the various events that appear in Island Rescue 6.3

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-14 Tips for Games and Simulations Random Numbers –Function that returns a fractional number between 0 and 1 –Function can be added by altering the more editing tag minimum: specifies a minimum value for the random number maximum: specifies a minimum value for the random number integerOnly: if the value is true, the function returns only whole numbers 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-15 Tips for Games and Simulations Random Numbers –Function that returns a fractional number between 0 and 1 –Function can be added by altering the more editing tag minimum: specifies a minimum value for the random number maximum: specifies a minimum value for the random number integerOnly: if the value is true, the function returns only whole numbers 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-16 Tips for Games and Simulations Playing Audio –Several classes include sounds –Sounds appear in the class’s thumbnail in the gallery –An object’s properties’ tab also allows for sound to be imported and played 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-17 Tips for Games and Simulations Importing Sounds –.wav or.mp3 sounds can be imported to an object Recording Sounds –With a mic attached to your computer, sounds can be recorded to the computer and then imported 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-18 Tips for Games and Simulations Character Builders –The people class provides many characters to choose from –Tool for building own characters is also included hebuilder shebuilder 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-19 Tips for Games and Simulations Hebuilder/Shebuilder –User selects the head, body, and leg types –User selects skin color, eyes, and mouth –User selects hair style and color –User selects the clothing 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-20 Tips for Games and Simulations Hebuilder and Shebuilder have custom methods 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-21 Tips for Games and Simulations Debugging with print –Diagnostic messages are statements that are inserted into a program to display information that can be used in debugging a program that isn’t working properly –Addition of the print instruction causes a menu to appear –Menu shows all the objects that appear in the world 6.4

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6-22 Tips for Games and Simulations Debugging with print –Diagnostic messages are statements that are inserted into a program to display information that can be used in debugging a program that isn’t working properly –Addition of the print instruction causes a menu to appear –Menu shows all the objects that appear in the world 6.4