Magic 8-Ball. Part One: Click a Button, Hear a Sound. DESIGN: App Inventor Designer. Magic 8-Ball Predicts the Future

Similar documents
App Development with MIT App Inventor

ACS-1805 Introduction to Programming (with App Inventor)

TalkToMe: Your first App Inventor app

AppyBuilder Beginner Tutorials

TalkToMe: A beginner App Inventor app

Getting Started with App Inventor

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. App Inventor Workbook

Hello App Inventor! Android programming for kids and the rest of us. Chapter 2. by Paula Beer and Carl Simmons. Copyright 2015 Manning Publications

Activity Digital Doodle

App Inventor 2: environment of development to make apps for android

Software Prototyping. & App Inventor

App Inventor + IoT: Basic Bluetooth Connection Setup

3. Text to Speech 4. Shake it

Tutorial guideline for App Inventor

CHAPTER 1 HelloPurr. The chapter covers the following topics:

Fortune Teller 2 What You'll Build 2 What You'll Learn 3 Iteration or how we will get to Finished App. 3

Except as otherwise noted, the content of this document is licensed under the Creative Commons Attribution 3.0 License

Printing Tips Revised: 1/5/18

PaintPot. Figure 2-1. The PaintPot app

SARS ANYWHERE ADMINISTRATION MANUAL APPENDICES

Campus Map App Tutorial

touchdevelop tutorial

Android Programming Family Fun Day using AppInventor

Help us make this document better smarttech.com/docfeedback/ SMART Ink 3.1 USER S GUIDE FOR WINDOWS OPERATING SYSTEMS

Basic Computer and Mouse Skills Windows 10

Introduction to Flash - Creating a Motion Tween

Following a tour is the easiest way to learn Prism.

Chapter 25. Build Creations with Your Photos

1. Beginner Tutorial Set Up Your Project Space Create the Application Testing the Application

iwebfolio.com If you need assistance with iwebfolio, there are several ways to look for help:

Transitioning Teacher Websites

MoleMash for App Inventor 2. Getting Started. Introduction. Workshop, S.1

LP2CD Wizard 2.0 User's Manual

Items in BLUE do not have video tutorials but use text directions only. Page 1

Learn to Code. App Inventor Overview

Outlook Web Access. In the next step, enter your address and password to gain access to your Outlook Web Access account.

1. Open Outlook by clicking on the Outlook icon. 2. Select Next in the following two boxes. 3. Type your name, , and password in the appropriate

Adobe Encore DVD Tutorial:

Microsoft PowerPoint and Digital Photos

GP NHSmail Migration. -How To Guide-

PaintPot: (Part 1) What You're Building. Before starting

FM 4/100 USB Software for OSX

Picture Talk App Directions (Version 2 of App Inventor) Description:

Tutorial for loading music files into an Ipad

How to get ebooks on to your Kindle

A Document Created By Lisa Diner Table of Contents Western Quebec School Board October, 2007

An online version of these worksheets is available at:

Working with Mailbox Manager

A. Outlook Web App -

How To Upload Your Newsletter

The Domino Designer QuickStart Tutorial

Navigating Windows 10 Windows 10 is the most recent version of the Microsoft Windows operating system.

Photoshop Fundamentals

GreenFolders User Manual

Creating a Website Using Weebly.com (June 26, 2017 Update)

Managing Apps and Notifications

Display Systems International Software Demo Instructions

University Academic Computing Technologies. Web-site:

Libraries. Multi-Touch. Aero Peek. Sema Foundation 10 Classes 2 nd Exam Review ICT Department 5/22/ Lesson - 15

NCMail: Microsoft Outlook User s Guide

SharePoint AD Administration Tutorial for SharePoint 2007

Was this document helpful? smarttech.com/docfeedback/ SMART Ink 5.2 USER S GUIDE

Cassette2CD Wizard 2.05 User's Manual

Remote Support DETAILS How to set up and connect

S A M P L E C H A P T E R

Copyright 1998 CH-UH Schools Revised 10/31/98 Authored by: Bob Torrelli Jim Harmon Hannah Reid. Technology Specialists, CH-UH Schools

SAS Mobile BI 8.14 for ipad and iphone: Help

USING DRUPAL. Hampshire College Website Editors Guide

the NXT-G programming environment

Kona ALL ABOUT FILES

MagicSoft Version 3.02

Introduction. Table Basics. Access 2010 Working with Tables. Video: Working with Tables in Access To Open an Existing Table: Page 1

Goldfish 4. Quick Start Tutorial

Bucknell University Digital Collections. LUNA Insight User Guide February 2006

eedge Basics: Send the Right Message at the Right Time Using eedge mymarketing

ekaizen Lessons Table of Contents 1. ebook Basics 1 2. Create a new ebook Make Changes to the ebook Populate the ebook 41

Fruit Snake SECTION 1

4Sight for Mac User Guide. Version 2.4

Xchange for Samsung MAC User Guide. Version 2.4

App #2 - Paint Pot. Getting Ready. Objectives: In this lesson you will learn to:

YIS. Faculty Resources > Shared Teacher > IT > New Website Training Tutorials The cotents of this folder include;

MCS3 USB Software for OSX

EKTRON 101: THE BASICS

Office 365: . Accessing and Logging In. Mail

SchoolDesk University

Inspire Ten Minute Task #1

The following instructions cover how to edit an existing report in IBM Cognos Analytics.

CSIS10A Installation Instructions for setting up the BlueJ Java IDE

Creating Web Pages with SeaMonkey Composer

MCS 2 USB Software for OSX

Mail overview. What you ll see in Mail.

Inspiration Quick Start Tutorial

Join a Skype for Business meeting from an SLT video conferencing room

What is OneNote? The first time you start OneNote, it asks you to sign in. Sign in with your personal Microsoft account.

lab A.3: introduction to RoboLab vocabulary materials cc30.03 Brooklyn College, CUNY c 2006 Name: RoboLab communication tower canvas icon

A new clients guide to: Activating a new Studio 3.0 Account Creating a Photo Album Starting a Project Submitting a Project Publishing Tips

PaintPot Hack This is an app with a background image of a cat that the user can draw on the image with different colors

remember where it is, My Documents or to the Desktop are good locations. If you do not have an extract option, you can usually just COPY and PASTE the

Acrobat 6.0 Standard - Basic Tasks

OnPoint s Guide to MimioStudio 9

Transcription:

Magic 8-Ball Magic 8-Ball Predicts the Future This introductory module will guide you through building a Magic 8-Ball app with App Inventor. When activated, your 8-ball will deliver one of its classic predictions, such as It is decidedly so or Reply hazy, try again. Learning Goals After completing this app, you will be able to: Navigate the App Inventor environment: designer, blocks editor, emulator and/or physical phone Correctly use the following App Inventor components: accelerometer sensor, image, list-picker Part One: Click a Button, Hear a Sound The final Magic 8-Ball App will deliver a prediction from a list that you have designed. To get started, first we'll make a button with a picture on it, and program it to play a sound when the button is clicked. DESIGN: App Inventor Designer 1. To open the App Inventor Designer window, go to http://appinventor.mit.edu and click "Invent". See setup instructions above if you are not sure how to sign in. 2. Click "My Projects" in the upper left corner of the screen, which will take you to your list of projects. Click "New" and name your project something like "Magic8Ball"(note: spaces are not allowed). 3. Download one image and one sound file from below to be used in your app. Right click (control-click) on the link of the image or sound, then choose "Download" or "Save As". Save the media files to a convenient location that you will remember. Link to download: http://tinyurl.com/ypcmobileapp 4. On the left column of the Designer, open the Basic palette, and drag a Button component over to the Viewer(#1). 5. Set the button image to an 8-Ball image: Click on your newly added button to see its properties in the Properties pane on the right. Under "Image" click on the word "None..." and a small selection window will pop up (#2). Click the "Add" button and browse to where you saved the 8-Ball image. Select the file, then click OK to close the selection window. Click OK again on the properties pane to close the small popup window (#3). 6. Go to the text field in the Properties pane and delete the display text of your button component (#4).

7. From the Media palette, drag over a Sound component onto the Viewer pane (#1). Notice that since the sound will not be a visible part of the app, it appears at the bottom of the Viewer pane, as a Non-visible component. 8. Set the sound component's source file: Click on your newly added sound component to see its properties in the Properties pane on the right. Under "Source" click in the small box on the word "None..." and a small selection window will pop up (#2). Click the "Add" button and browse to where you saved the sound file. Select the sound file, then click OK to close the selection window. Click OK again on the properties pane to close the small popup window (#3). 9. You have now completed the work in the Designer for Part One of this app. It's time now to go over to the Blocks Editor to program the behavior of these components. BUILD: Blocks Editor 10. In the upper right corner of the Designer, click on the Blocks Editor button. Wait for a few moments while the blocks editor loads. This takes some time, and often requires you to click accept, ok, or keep as the java program downloads to your computer. (Be sure to look at the very top or very bottom of your browser to see if it is prompting you to accept.) If you are having trouble loading the Blocks Editor, go back to the Setup Instructions for help. 11. Now you are going to tell your app how to behave when the button is clicked. This is actually very simple in App Inventor, because the "code" for the program only consists of two blocks! 12. Once the Blocks Editor is open, there are several options running along the left side of the screen. We refer to these as "Palettes" with Drawers. 13. From the My Blocks palette, click on the Button1 drawer. Drag the when Button1.Click block into the work area (#1). From the My Blocks palette, click on the Sound1 drawer, drag the Sound1.Play block into the work area and insert it into the when Button1.Click block (#2). They will click together like magnetic puzzle pieces.

Your blocks should now look like this: Part Two: Click the Button, Get a Prediction + Hear a Sound Now that we've gotten the button to perform an action (play a sound), we want to extend that action to include giving the user a prediction. First we'll need two labels: Label1 will display the instructions, and Label2 will display the chosen prediction. We'll use blocks to program a "list picker" to choose from a list of predictions. Each time the button is clicked, the app will change the text of Label2 to display the chosen prediction. DESIGN: App Inventor Go back to the Designer window in your browser and add some new things to your app. 1. From the Screen Arrangement palette, drag over the Vertical Arrangement component (#1). At first it will just look like an empty box, but when you put things in it, App Inventor will know that you want to line them up vertically (one on top of the other).

2. From the Basic palette, drag over a Label component (#2) and drop it inside of the vertical arrangement component. In the Properties pane, change the "Text" property of Label1 to Ask the Magic 8-Ball a question.(#3)

3. From the Basic palette, drag over another Label component (Label2) into the Vertical Arrangement box so that it sits right below Label1. Change the "Text" property of the Label2 to Touch the Magic 8-Ball to receive your answer. Now drag the 8-Ball image so that it is also inside the Vertical Arrangement component on top of the two labels. This will cause them to line up with each other in a vertical line. (Note: this can be tricky mouse work, but get them in there just right and the vertical arrangement will resize itself to fit everything.) BUILD: Blocks Editor Now for the fun part! You're going to make a list of predictions and program the button to pick one item from the list and display it inside Label2. The button will also still play the sound that you programmed in Part One. Here's how to do it... 1. From the My Blocks palette, click on Label2 drawer to see all of its associated blocks. Drag over the blue set Label2.Text and insert it just above the Sound1.Play block. Notice that the when

Button1.Click block automatically gets bigger to accomodate the new block.

2. From the Built-In palette, click on the Lists drawer. Drag over the pick random item block and connect it to the open socket of the set Label2.Text block. 3. From the Built-In palette, click on Lists again, then drag out the make a list block and plug it into the "list" socket on the right side of the pick random item block. 4. From the Built-In palette, click on the Text drawer, drag out a text block and connect it to the item socket of the make a list block. Click directly on the word text so that it gets highlighted. You can then type in new text there. Think about the sayings you want in your list of predictions for the Magic 8-Ball. Type the first prediction into this new text block. 5. Notice that when you plug in a new text block, the make a list block automatically creates a new socket. Repeat the previous step for each of the prediction choices you want programmed into your 8-Ball App. Plug each text block into the pick random item block. Blocks should look something like this:

(Note: it is normal for there to be a blank "item" space at the end of the make list block.) Part Three: Shake the Phone, Get a Prediction + Hear a Sound Even though you have a working Magic 8-Ball app, there is a way to make it even more fun. You can use the accelerometer component to make the phone respond to shaking instead of responding to a button click. This will make the app much more like a real Magic 8-Ball toy. Note: This part can only be done with an actual phone or tablet equipped with an accelerometer. If you are using an emulator, skip this part and go to Challenge 1 instead. DESIGN: App Inventor From the Sensors palette, drag over an AccelerometerSensor sensor component. Notice that it automatically drops down to the Non-visible components area of the Viewer window. This is the only new component you need, so go on over to the Blocks Editor to change your program. BUILD: Blocks Editor 1. From the My Blocks drawer, click on AccelerometerSensor, then drag out the block for when AccelerometerSensor.Shaking. 2. Disconnect all of the blocks from inside the Button1.Click block and move them inside the AccelerometerSensor.Shaking block. NOTE: you can move whole sections of connected blocks by clicking on the uppermost or leftmost block and dragging it. The connected blocks will come with it. 3. Delete the Button1.Click block to keep your work area tidy. The blocks should look something like this:

TEST: Phone/Emulator Phone: When you shake the phone it should show an answer and play a sound. Emulator: unfortunately, you can not simulate shaking the phone when using the emulator. You've got a Magic 8-Ball App! Now your app is fully functional and will predict the future with absolute certainty. Test out that this works, and then come back for some challenge tasks to make the app even more fun.