Procedures, Simple Expressions

Slides:



Advertisements
Similar presentations
Understanding an Apps Architecture ASFA Computer Science: Principles Fall 2013.
Advertisements

Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Adventures in Animation Alice – Advanced! Michelle Venable-Foster June 2006.
Presented at : CS4HS University of Massachusetts Lowell Kelly Powers, AMSA Charter School, Mark Sherman, UML, Fred Martin, UML, June 27 th, 2011 Portions.
Chapter 2. Paint Pot We will build the Paint Pot app in class. Notes regarding the screen/user interface: 1.7 buttons and a canvas 2.The canvas has a picture.
Games in AppInventor ASFA Programming I November 14, 2012.
App Inventor Barb Ericson July 3, 2013.
Programing App Inventor. Variable Declaration App Inventor: Declare Variables using the “Define Variable As” Block – Find the Blocks Editor (top-left),
Android Apps: Building Blocks Module 6, Intro to I.T., Fall 2011 Sam Scott.
SCERSIG: Creating Android Apps with App Inventor 26 October 2011 Ric Paul, Health Services Library, Southampton.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Hack Day Tweet about Hack Day today! _technovation_.
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Creating Mobile Apps with App Inventor! Day 5 Google search Kris Gordon Ludlow for links.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
CS 104 October 26, 2011 App Inventor. Agenda Discuss guest speakers Discuss quiz Finish Paint Pot Discuss concepts from Chapters 2 & 3 Mole Mash (if time.
Intro to AppInventor Dr. Dante Ciolfi (chawl fee).
App Inventor MIT App Inventor.
Hack Day. Welcome to Hack Day! Meet your mentor and your teammates! Share: –What’s your name? –What school do you go to (or company do you work for)?
DUE Starting AppInventor Working Connections 2012.
Click on these! %2Fblank%2Fbrowse.asp%3FA%3D383%26BMDRN%3D2000%26BCOB%3D0% 26C%3D64893.
Quiz Me Tutorial. Introduction QuizMe is a trivia game (the example uses baseball) you can use as a template to build quizzes on any topic. The user steps.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
App Inventor for Android 唐健恒. Outline About App Inventor Getting started Tutorials Reference Documentation  Component Reference  Blocks Reference.
Lesson 5 – Repetition / Loops
ICT/COMPUTING RULES Only use software allowed by the teacher
Lesson 1 – Getting Started with App Inventor
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Whittier STEM Fair 2016 CARLI PECORARO’S ANDROID APP PROJECT.
Introduction to Programming and App Inventor. Introduction What is a computer program? Introducing App Inventor Getting hands on with App Inventor.
Introduction to App Inventor 2 ASFA AP CS Principles
North Attleboro High School
Create a Halloween Computer Game in Scratch
Visual Programming week # 01
Visual Programming week # 02 APP (Application) Architecture.
3.01 Apply Controls Associated With Visual Studio Form
week # 03 Visual Programming Variables Canvas Screen Arrangement
Understanding an App’s Architecture
3.01 Apply Controls Associated With Visual Studio Form
Videos For All Classrooms
Chapter 16 – Programming your App’s Memory
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Scratch Programming Intro
Visual Programming week # 06
Michelle Venable-Foster Barb Ericson Jan 2007
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Checking for Collisions: Using Functions in Alice
Visual Basic: Week 5 Review User defined functions
Visual Programming Week # 11
Visual Programming Week # 10
Creating Animated Apps: Canvas與ImageSprite 靜宜大學資管系 楊子青
Introduction to Snap Programming
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Visual Programming week # 05 Lists Quiz Tutorial.
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Creating a Simple Game in Scratch
Visual Programming week # 14 Review for Final Exam.
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Visual Programming Week # 13
Visual Programming Week # 07
Visual Programming Week # 12
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Pen Cards Pen Cards Back and Forth Draw a Line Special Effects
Catch Game Cards Catch Game Cards Make a Card Go to the Top Fall Down
Presentation transcript:

Procedures, Simple Expressions Visual Programming week # 04 Animation: ImageSprite, Clock Procedures, Simple Expressions

Outline 1. Tutorial # 04: Mash Mole 2. ImageSprite, Clock 3. 3. Procedures 4. Animation 5. Homework # 03 VP Lecture Note by Dr. Hanh Pham 2

Tutorial # 04: “Mole Mash” TASK: Build game “MoleMash”: a mole pops up at random positions on a playing field, and the player scores points by hitting the mole before it jumps away. The PROBLEM (requirements):  display a Mole picture and make it move randomly user can try to touch/click on the Mole 2 labels showing 2 counts:  Hit count: if user hit the count increases  Miss count: if user miss the count increases have a button to reset 2 counters to 0  VP Lecture Note by Dr. Hanh Pham 3

Tutorial # 04: “Mole Mash” INSTRUCTIONS to Build: Download files hit.mp3, miss.mp3 and mole.png at http://cs.newpaltz.edu/~phamh/avp/Homework/hw03/ 1) Create a new project called “t4_MoleMash” 2) In DESIGN window: • add Canvas, set Width=300, Height=300 • under Animation: get “Image Sprite” and drag it ONTO Canvas. Set Interval=500 4 labels in “HIT=1 MISS=3” 1 button for RESET 1 sound for noise • VP Lecture Note by Dr. Hanh Pham 4

VP Lecture Note by Dr. Hanh Pham Tutorial # 04: “Mole Mash” The DESIGN window should look like this: VP Lecture Note by Dr. Hanh Pham 5

Tutorial # 04: “Mole Mash” & PROCEDURE In BLOCK EDITOR window: 1) Create an Event Handler for when the RESET button is TOUCHED: VP Lecture Note by Dr. Hanh Pham 6

Tutorial # 04: “Mole Mash” & PROCEDURE 2) Create a PROCEDURE called MoveMole: • Under “Built-in”, and “Procedure”: get FIRST BLOCK and change name to MoveMole • To CALL/USE this procedure: go BACK to under “Built-in”, and “Procedure”: there appear the THIRD BLOCK VP Lecture Note by Dr. Hanh Pham 7

Tutorial # 04: “Mole Mash” & PROCEDURE • Click on “MATH”, then get 2 “Random Integer” blocks and change to get this: • Under “Built-in”, “Screen1” and “MyCanvas”, click on “MOLE to get the “Call MOLE.MOVE to” block • Then, we have these blocks: VP Lecture Note by Dr. Hanh Pham 8

Tutorial # 04: “Mole Mash” & & PROCEDURE • Then, Plug them to get this: • Now we have a PROCEDURE called MoveMole: and can CALL/USE this procedure: go BACK to under “Built-in”, and “Procedure”: there appear the THIRD BLOCK VP Lecture Note by Dr. Hanh Pham 9

Tutorial # 04: “Mole Mash” & PROCEDURE In BLOCK EDITOR window: 3) Create an Event Handler for the START of the game: • Under “MyBlocks”, “Screen1”, get “Screen1.Initialize”: • Under “MyBlocks”, “MyDefinition”, get “call MoveMole”: 4) Create an Event Handler for the MOVING the MOLE every second: • Under “MyBlocks”, “MoleTimer”, get “MoleTimer.Mole” Then , CALL procedure MoveMole (repeat above) VP Lecture Note by Dr. Hanh Pham 10

Tutorial # 04: “Mole Mash” 5) Create an Event Handler for when the CANVAS is TOUCHED: • Get “MyCanvas.Touched” Under “Built-In”, “Control”, get “If-Then” VP Lecture Note by Dr. Hanh Pham 11

Tutorial # 04: “Mole Mash” 3) Create an Event Handler for when the CANVAS is TOUCHED: • Conditional Statement (ask a question) IF-ELSE: • Under “MyBlocks”, “MyDefinition”, get “value touchedSprite” and plug it to “test” Under “MyBlocks”, “HitCountLabel”, get “then-do” “HitCountLabel.Text” and plug it to VP Lecture Note by Dr. Hanh Pham 12

Tutorial # 04: “Mole Mash” • WHEN the user touch hits the Molle Image: We want to do: HitCount = HitCount + 1 • Left Click and choose “MATH”, then “+” Under “MyBlocks”, “HitCountLabel” & get HitCountLabel.Text and a number “1”: • Plug them together we’ll have: VP Lecture Note by Dr. Hanh Pham 13

Tutorial # 04: “Mole Mash” The BLOCK EDITOR window look like this: VP Lecture Note by Dr. Hanh Pham 14

Homework # 03: “Catch Me !” The PROBLEM(requirements): Your APP must have a GUI as shown in this picture:  have an image that moves around randomly  user can click on the canvas (height=250). If it hits the image then increase the hit count and play a HIT sound. If it misses the image then increase the miss count and play a MISS sound. In both cases recalculate the hit% and display it: Hit%=100*hit/(hit+miss). the hit% hit+miss  has a textbox so that the user can type a text in  a button to print that text on the canvas and also speak the text  have a button to let user to wipe the canvas and also clear the textbox You can use the media files at: http://cs.newpaltz.edu/~phamh/avp/Homework/hw03/ VP Lecture Note by Dr. Hanh Pham 15

Homework # 03: “Catch Me !” In DESIGN window add these components: VP Lecture Note by Dr. Hanh Pham 16

Homework # 03: “Catch Me !” In Block EDITOR window ADD these blocks and connections: VP Lecture Note by Dr. Hanh Pham 17

Homework # 03: “Catch Me !” Change font SIZE and COLOR in Block EDITOR window : VP Lecture Note by Dr. Hanh Pham 17

References These slides contain materials from many sources including the following: • http://www.appinventor.org http://appinventor.mit.edu “App Inventor: Create Your Own Android Apps” by David Wolber, Hal Abelson, Ellen Spertus, Liz Looney, Publisher: O'Reilly App Inventor for Android: Build Your Own Apps - No Experience Required, Jason Tyle • VP Lecture Note by Dr. Hanh Pham 18