 2004 Prentice Hall, Inc. All rights reserved. Chapter 18 – Macromedia Flash MX 2004: Building an Interactive Game Outline 18.1 Introduction 18.2 Object-Oriented.

Slides:



Advertisements
Similar presentations
INTRODUCTION TO ADOBE FLASH CS4
Advertisements

1What is the Stage. 2How do you open a panel in Flash
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
Macromedia Flash MX 2004 – Design Professional and Interactivity WORKING WITH SYMBOLS.
1 Flash Actionscript Event Handling. 2 Event Handling Right now we know all about variables lets go back to our text input/output example: Suppose we.
Work with symbols and instances Work with Libraries Create buttons Assign actions to buttons Unit Lessons.
Introduction to Macromedia Flash 8
1 Flash Actionscript Adding Interactive Actions. 2 ActionScript 3.0 ActionScript is the language you use to add interactivity to Flash applications, whether.
1 Flash and Animation Presented by : Behzad Sajed Khosrowshahi.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Creating Animation Pertemuan Matakuliah: L0182 / Web & Animation Design Tahun: 2008.
© 2011 Delmar, Cengage Learning Chapter 8 Building Complex Animations.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Chapter 3 Working with Symbols and Interactivity.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 17 – Macromedia Flash MX 2004: Building Interactive Animations Outline 17.1 Introduction 17.2 Flash.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
BUILDING RICH MEDIA ELEMENTS. Design Decisions Based on Design Specification  Following the design specification will ensure that the application is.
Introduction to Flash FYS100 Creative Discovery in Digital Art Forms Spring 2007 Burg.
Flash MX II. Flash MX – Tweened Animation There are two methods for creating an animation sequence in Flash –Frame-by-frame animation –Tweened animation.
Lehigh University Introduction to Flash MX Sharmeen Mecklai.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Button library Create a button Learn.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Buttons library Edit a button instance.
Chapter 11 Adding Sound and Video. Chapter 11 Lessons 1.Work with sound 2.Specify synchronization options 3.Modify sounds 4.Use ActionScript with sound.
© 2011 Delmar, Cengage Learning Chapter 9 Introduction to ActionScript 3.0.
 2008 Pearson Education, Inc. All rights reserved Adobe ® Flash ® CS3: Building an Interactive Game.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Symbols and Interactivity.
© 2012 Adobe Systems Incorporated. All Rights Reserved. Copyright 2012 Adobe Systems Incorporated. All rights reserved. ® INTRODUCTION TO FLASH ANIMATION.
Copyright © 2003 Pearson Education, Inc. Chapter 3, Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
® Copyright 2010 Adobe Systems Incorporated. All rights reserved. ® ® 1 INTRODUCTION TO ADOBE FLASH PROFESSIONAL CS5.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
Programming games Show your version of Bo the dog. Start cannonball Preview: video, audio work session (cannonball) Homework: Cannonball with ball in a.
XP Tutorial 4 Special Animations. XP New Perspectives on Macromedia Flash MX Special Layers for Animation Animation Using a Motion Guide Layer.
7-1 OBJ Copyright 2003, Paradigm Publishing Inc. Using ActionScript and Creating Templates Macromedia Flash Design & Application.
Adobe Flash CS5 Introduction. What is Flash? Flash is a multimedia platform used to add animation, video, and interactivity to Web sites. It is often.
Creating Buttons – Lesson 71 Creating Buttons Lesson 7.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
Introduction to Flash MX 2004: Action Scripting Lloyd Rieber.
2006 Adobe Systems Incorporated. All Rights Reserved. 1 INTRODUCTION TO ADOBE FLASH CS3.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
Distributed Multimedia Programming Week – 4A Buttons Movie Clips.
© Anselm Spoerri Lecture 10 – Related: Part 1 Flash –Build Flash Website with Animated Navigation Structure –Decide on Overall Navigation Layout, Import.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Macromedia Flash MX 2004 – Design Professional Special Effects CREATING.
Introduction to Flash CSC361/661 Digital Media Spring 2007 Burg.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Macromedia Flash Design Professional And Interactivity WORKING WITH SYMBOLS.
© 2011 Delmar, Cengage Learning Chapter 10 Using ActionScript to Enhance User Experience.
XP Tutorial 7 Creating a Flash Web Site. XP New Perspectives on Macromedia Flash 82 Objectives Plan and create a Flash Web site Create a Flash template.
Creating an Animated Map – Lesson 91 Creating an Animated Map Lesson 9.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
FLASH!!!!!!!!!!!!!!!!!!!!!!!!! A TUTORIAL BY BRITTANY HESS AND MARGARET DENTON.
CIS 205—Web Design & Development Flash Chapter 3 Appendix on Using Buttons.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
Intro to ActionScript CIS 126 Greg Shorts. What Is ActionScript? ActionScript is the scripting language Flash uses to control its movies and the objects.
DM 11- Flash –Unit C and Interactivity WORKING WITH SYMBOLS.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
Macromedia Flash MX Design Professional And Interactivity WORKING WITH SYMBOLS.
CDM105 Session 12 Macromedia FLASH MX 2004 Part 5 : Sounds, publishing your movies, and the ‘Get URL’ action.
 Movieclip symbols are reusable pieces of flash animation  consisting usually of one or more graphic/button symbols  thus they are flash movies within.
Tutorial 3 Creating Animations.
Tutorial 3 Creating Animations.
Adding Buttons, Actions, and Sounds
Unit Lessons Work with actions
INTRODUCTION TO ADOBE FLASH CS4
Chapter Lessons Create shape-tweened animations Create a mask effect
Working with Symbols and Interactivity
Presentation transcript:

 2004 Prentice Hall, Inc. All rights reserved. Chapter 18 – Macromedia Flash MX 2004: Building an Interactive Game Outline 18.1 Introduction 18.2 Object-Oriented Programming 18.3 Objects in Flash 18.4 Preliminary Instructions and Notes Manual Coding Labeling Frames Using the Actions Layer 18.5 Adding a Start Button 18.6 Creating Moving Objects Adding the Target Adding the Blocker 18.7 Adding the Rotating Cannon Coding the Cannon’s Rotation Hiding the Cannon Layer

 2004 Prentice Hall, Inc. All rights reserved. Macromedia Flash Case Study: Building an Interactive Game 18.8 Adding the Cannon Ball Initializing the Ball’s Motion Variables Scripting the Ball’s Motion 18.9 Adding Sound and Text Objects to the Movie Adding the Time Counter Adding the Time Box Creating a Final Animation Sequence Detecting a Miss Creating a Function Adding Collision Detectors Adding Collision Detection to the Blocker Adding Collision Detection to the Target Finishing the Game ActionScript 2.0 Elements Introduced in This Chapter

 2004 Prentice Hall, Inc. All rights reserved. Objectives In this tutorial, you will learn: –To learn advanced ActionScript in Flash MX –To build on Flash skills learned in Chapter. –To create a functional, interactive Flash application.

 2004 Prentice Hall, Inc. All rights reserved Introduction Macromedia Flash MX 2004 –Useful for creating short animations –Capable of building larger, interactive applications

 2004 Prentice Hall, Inc. All rights reserved Object-Oriented Programming ActionScript 2.0 –Object-oriented scripting language Classes –A collection of properties and methods Instance –One member of a class –Closely resemble JavaScript

 2004 Prentice Hall, Inc. All rights reserved Objects in Flash Dynamic position –Create new Flash document –Draw black box and convert it to a movie clip symbol –Drag another instance of movie clip from Library onto stage –Change instance names of first box to box1 and the other to box2 –Add script in Actions panel –Test movie

 2004 Prentice Hall, Inc. All rights reserved Preliminary Instructions and Notes Template file for the game is named cannontemplate.fla –Chapter 18 directory from CD-ROM Play different sections of movie clips by referencing frame labels

 2004 Prentice Hall, Inc. All rights reserved Manual Coding Manually enter code into the Actions panel Use ActionScript Dictionary from Help

 2004 Prentice Hall, Inc. All rights reserved Labeling Frames Label each frame in main timeline to represent its purpose in the game Select first frame of Labels layer Enter intro into the Frame Label field in the Property inspector Label second frame game and third frame end

 2004 Prentice Hall, Inc. All rights reserved Using the Actions Layer Create an Actions layer to make larger applications more compartmentalized Add stop actions to all three frames in the Actions layer

 2004 Prentice Hall, Inc. All rights reserved Adding a Start Button Create simple starting frame for game –Select first frame of the Intro/End layer –Drag introText movie clip and the Play button onto stage –Resize Play button –Select Play button and add script

 2004 Prentice Hall, Inc. All rights reserved Adding a Start Button Fig. 18.1Positioning the introText movie clip and Play button.

 2004 Prentice Hall, Inc. All rights reserved Adding the Target Object Create moving target –Position the target –onClipEvent Event handler that detects when the specified event occurs Runs when the clip first loads

 2004 Prentice Hall, Inc. All rights reserved. Outline Oscillating Object (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Adding the Blocker Moving target object –Block the ball –Add difficulty to the game –Select frame of Blocker layer –Drag an instance of the blocker object onto stage –Copy script from target object’s Actions panel –Paste script in blocker’s Actions panel

 2004 Prentice Hall, Inc. All rights reserved. Outline Adding Oscillation to the blocker object (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Adding the Blocker Fig. 18.4Oscillating blocker and target.

 2004 Prentice Hall, Inc. All rights reserved Adding the Rotating Cannon Cursor-responsive effect –Select second frame of Cannon layer –Drag Cannon object from Library onto the stage

 2004 Prentice Hall, Inc. All rights reserved Adding the Rotating Cannon Fig. 18.5Cannon position.

 2004 Prentice Hall, Inc. All rights reserved Coding the Cannon’s Rotation Select the canon –Open its Actions panel –Add code in Fig Rotates the cannon barrel to point toward cursor –Event handler onClipEvent Executes every time the mouse moves

 2004 Prentice Hall, Inc. All rights reserved. Outline Rotating the cannon object (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Coding the Cannon’s Rotation actual coordinates (0, 200)  x y relative to cursor (0, 0) actual position: (75, 250) relative position (to cannon): (75, 50) Fig. 18.7Rotating the cannon object.

 2004 Prentice Hall, Inc. All rights reserved Hiding the Cannon Layer Select Show/Hide dot in the layer name portion of timeline –Red x Indicate that layer is invisible for editing Clicking the Show/Hide x again will make the Cannon layer visible

 2004 Prentice Hall, Inc. All rights reserved Hiding the Cannon Layer Show/Hide selectorsHidden layer Fig. 18.8Show/Hide layers.

 2004 Prentice Hall, Inc. All rights reserved Adding the Cannon Ball Drag ball symbol from the Library onto stage in frame 2 of Ball layer

 2004 Prentice Hall, Inc. All rights reserved. Outline Setting the ball object’s fire ratio (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved. Outline Moving the fired ball object (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Adding Sound and Text Objects to the Movie Add keyframe to frame 2 of Text layer Drag text symbol from Library into stage Add keyframe to second frame to Sound and ScoreText layers Add instance of sound and scoreText objects Lock and unlock layers by clicking Lock/Unlock

 2004 Prentice Hall, Inc. All rights reserved Adding Sound and Text Objects to the Movie Lock/Unlock selector Fig Locking/Unlocking layers.

 2004 Prentice Hall, Inc. All rights reserved Adding the Time Counter Time –An important aspect of many games and applications

 2004 Prentice Hall, Inc. All rights reserved Adding the Time Box Remaining time –Displayed in dynamic text box in bottom-left corner

 2004 Prentice Hall, Inc. All rights reserved. Outline Time-decrease code (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Creating a Final Animation Sequence Final animation sequence –Informs user of the outcome of the game

 2004 Prentice Hall, Inc. All rights reserved Detecting a Miss Detects when the ball has been fired off the stage

 2004 Prentice Hall, Inc. All rights reserved. Outline Miss detection in Flash (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Creating a Function Functions in Flash –Block of code that can be called multiple times –Used when specific task needs to be repeated many times in different parts of movie –Bound to object in which it is created –Global function Accessible from any part of movie

 2004 Prentice Hall, Inc. All rights reserved. Outline Function creation in Flash (1 of 2)

 2004 Prentice Hall, Inc. All rights reserved. Outline Function creation in Flash (2 of 2)

 2004 Prentice Hall, Inc. All rights reserved Adding Collision Detection to the Blocker Built-in collision detection method –Determines whether two objects are overlapping

 2004 Prentice Hall, Inc. All rights reserved Adding Collision Detection to the Target Add code to target that increases player’s remaining time each time target is hit

 2004 Prentice Hall, Inc. All rights reserved. Outline Collision detection in Flash (1 of 1)

 2004 Prentice Hall, Inc. All rights reserved Finishing the Game hitCounter is greater than or equal to 5 –Player has destroyed the entire target –Global variable winner is set to true –Frame labeled end is played

 2004 Prentice Hall, Inc. All rights reserved ActionScript 2.0 Elements Introduced in This Chapter