AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 6 "The games of a people reveal.

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

 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.
This game is loosely based on the Whack-A- Mole arcade game.  Each game starts with 45 seconds of play.  Moles randomly pop out of holes on the landscape.
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.
Flash Workshop Flash Workshop :: Agenda  Introductions  Look at a few Flash Examples  Flash Web Sites  Flash Web Applications  Flash Games.
Work with symbols and instances Work with Libraries Create buttons Assign actions to buttons Unit Lessons.
1 Flash Actionscript Adding Interactive Actions Variables.
Kapi’olani Community College Art 258 Interface Programming II In-class Presentation Week 5A.
Flash Quizzes Quiz templates generate quizzes that use Flash Interaction Components.
1 Flash Actionscript Adding Interactive Actions. 2 ActionScript 3.0 ActionScript is the language you use to add interactivity to Flash applications, whether.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
MovieClips & Properties Flash ActionScript Introduction to Thomas Lövgren
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.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 3 "The games of a people reveal.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Button library Create a button Learn.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
My First ACCESSIBLE Flash Movie. Course notes Detailed course notes, a printable copy of my slides, and all the samples shown today can be downloaded.
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.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Symbols and Interactivity.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 8 "The games of a people reveal.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 3 "The games of a.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 8 "The games of a.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 2 "The games of a.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 3 "The games of a.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg.
Introduction to Flash MX 2004: Action Scripting Lloyd Rieber.
CSC 361/661 Digital Media Spring 2010 Professor Burg.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script "The games of a people reveal.
Mouse Events & Keyboard Inputs Flash ActionScript Introduction to Thomas Lövgren
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Sound in Action Script "The games of a people reveal.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
Distributed Multimedia Programming Week – 4A Buttons Movie Clips.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 3 "The games of a people reveal.
Introduction to Flash CSC361/661 Digital Media Spring 2007 Burg.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
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.
[My] Experiences building games in Visual Basic & Flash Focus on 'cannonball' Jeanine Meyer Math Senior Seminar.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 6 "The games of a.
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Action Script 12 "The games of a people.
Programming games Flash concepts. Coin toss. Filezilla: upload your project(s) Homework: Enjoy Spring Break.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 12 "The games 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.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 5 "The games of a people reveal.
UFCFY5-30-1Multimedia Studio Scripting for Interactive Media Using Interface Fields to Receive and Display Data to the User.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script "The games of a people.
Macromedia Flash MX Design Professional And Interactivity WORKING WITH SYMBOLS.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 11 "The games of a people reveal.
 Movieclip symbols are reusable pieces of flash animation  consisting usually of one or more graphic/button symbols  thus they are flash movies within.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 12 "The games of a people reveal.
var variableName:datatype;
Interface Programming 2 Week 1
Working with Symbols and Interactivity
MovieCLip Instances & ActionScript
Presentation transcript:

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 6 "The games of a people reveal a great deal about them.“ Marshall McLuhan

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule All scripts are in the Actions layer, first frame. This will hide the titleScreen movie clip (intro and title of the game) on the release event and startgame function will be called. titleScreen.onRelease = function() { this._visible = false; startgame(); } this._visible = false;hides titleScreen movie clip

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule nmcounter from 0 to 8 nm=“m”+Inm will be m0, m1, m2, m3, …capsule movie clips startgame = function() { for (var i = 0; i < 9; i++) { var nm = "m" + i;

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule Functions for each capsule. onPresswhen the user presses mouse button down whacksvariable to calculate number of successful whacks scoreDisplay.whack_txt.text = whacks;displays the new value of whacks in the whack_txt d.text field _root[nm].onPress = function() { if (this._currentframe == 10) { this.play(); whacks++; scoreDisplay.whack_txt.text = whacks; doWhackAt(_xmouse, _ymouse); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule _root[nm].onPress = function() { if (this._currentframe == 10) { this.play(); whacks++; scoreDisplay.whack_txt.text = whacks; doWhackAt(_xmouse, _ymouse); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule calls doWhackat function and passes the current position of the mouse cursor doWhackAt(_xmouse, _ymouse);

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule Capsule animation function onEnterFramefunction for the capsule will be called every frame of the movie fps = 31, 31 times per second Selects random number from 0 to 100 if the capsule in the 1 frame If capsule on frame 10 (fully extended position) the random value between 0 and 100 will be selected and if this number is less then 10 then capsule.play() will animate capsule down If capsule is down it will rise every 3 seconds If capsule is up if will drop within a second to give the user opportunity to click it

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule _root[nm].onEnterFrame = function() { if (this._currentframe == 1) { if ((Math.random() * 100) < 1) { this.play(); } else if (this._currentframe == 10) { if ((Math.random() * 100) < 10) { this.play(); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule Initialize variable whacks to 0 (the score) And display it in the whacks_txt dynamic text field in the scoreDisplay movie clip whacks = 0; scoreDisplay.whack_txt.text = whacks;

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule getTimer() function returns the number of milliseconds elapsed since the game started to execute endTime variablewill take 30 seconds into the future To determine an amount of time remaining in the game endTime = getTimer() ;

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule Main timeline function that keeps the time and determines when the game is over etimekeeps track of remaining time between the endTime and now (from getTimer) getTimer() constantly changing causing etime to get smaller as time elapses var etime = endTime - getTimer();

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule IF remaining time is lass then 0 then “ TimeUP” message is displayed on the dynamic test field time_txt in the scoreDisplay movie clip _root.onEnterFrame = function() { var etime = endTime - getTimer(); if (etime <= 0) { scoreDisplay.time_txt.text = "Time Up";

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule And functions assigned to capsules are deleted onPress, onEnterFrame, stops capsules at current position, and kills timer function in the main timeline for (var i = 0; i < 9; i++) { var nm = "m" + i; delete _root[nm].onPress; delete _root[nm].onEnterFrame; _root[nm].stop(); delete _root.onEnterFrame; }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule If there is still time remaining in the game the time is displayed in the text field time_txt with the wrold “sec” etime/1000 returns number of seconds Math.ceilrounds up floating point value to the nearest integer else { scoreDisplay.time_txt.text = Math.ceil(etime / 1000) + " sec"; }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule doWhackAt function displays a successful graphics “whack!” if the user clicks the capsule at the right moment at the mouse cursor position wcnt variable to store instances of the successful whakcs nmtemporary variable to name instances wc0, wc1, wc2, wc3….. _root.attachMovie("whackSign", nm, wcnt + 99); takes whckSign movie clip from the library and positions it on the stage instance name (wc0, wc1, …) depth level 99, 100, 101, 102,…

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule wcnt = 0; doWhackAt = function(x, y) { var nm = "wc" + wcnt; _root.attachMovie("whackSign", nm, wcnt + 99); _root[nm]._x = x; _root[nm]._y = y; _root[nm]._xscale = _root[nm]._yscale = 60;

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule Fades away the movie clip from 100% to 0% in 10 frames _root[nm].onEnterFrame = function() { this._alpha -= 10; if (this._alpha <= 10) { delete this.onEnterFrame; this.removeMovieClip(); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Whack A Capsule wcnt++; wcnt %= 5; The value of wcnt will be always 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, …. It is unlikely that the user will have more then 5 on screens at once because they fade away quickly