SlideShare a Scribd company logo
1 of 33
Download to read offline
An Introducton to Game
Programming with Flash
1. An Introducton to Flash and Acton Script 3
Resources
● GitHub (https://github.com/krzysztof-o/epi-wdpg)
● Slideshare (http://www.slideshare.net/krzysztofopalka/)
● Recommended books
● Moock C., Essental ActonScript 3.0, O'Reilly Media, 2007
● Sanders W., Cumaranatunge Ch., ActonScript 3.0 Design Patterns, O'Reilly Media, 2007
● Imbert T., Introducing Starling, O'Reilly Media, 2012
● Recommended websites
● http://gaming.adobe.com/
● http://www.adobe.com/devnet/games.html
● http://help.adobe.com/en_US/FlashPlatform/reference/actonscript/3/index.html
● http://www.bytearray.org/
Why browser games?
● Low entry barriers
● Easy distributon
● Integraton with social networks
● Real tme analytcs
● Contnuous Deployment is possible
● Big Players do browser games
Choosing technology
VS.
WebGL
Canvas CSS3
Audio
Video
Local Storage Sockets
Open Web
Open Web
● Cross-platform
● Dynamic growth
● Do not rely on mobile
app stores
● Client and Server code
in JavaScript
● Always bet on JavaScript
● Atwood's Law
Pros Cons
● Lack of tools
● Differences in implementaton
● JavaScript – The World's Most
Misunderstood Language
Flex SDK
Adobe AIR Stage3D
Flash Builder
Flash PRO
Flex Framework
Flash Platform
Flash Platform
● Mature technology
● Great tools
● Consistency between
platforms
● ActonScript 3
● Mobile apps using
Adobe AIR
Pros Cons
● Doesn't work in mobile
browsers
● Bad PR
● Unknown future
Memory Game
git clone git://github.com/krzysztof-o/epi-
wdpg.git
Memory Game
Variables and constants
var myString:String = "Hello World!";
var myNumber:Number = 589.25;
var myInt:int = -5;
var myUint:uint = 5;
var isClicked:Boolean = true;
const MARGIN:Number = 10;
Embeding assets
git checkout v1.2
[Embed(source="assets.swf", symbol="card")]
private const BACKGROUND:Class;
var background:Sprite = new BACKGROUND();
Assets
Sprite ”background”
980px
580px
Assets
MovieClip ”card”
1. frame 2. frame 4. frame3.frame 5. frame
Sprite vs. MovieClip
Display List
addChild(background);
addChildAt(background, 0);
getChildAt(0); //background
getChildIndex(background); //0
removeChild(background);
Display List
Coordinates system
(0,0) x
y stage
Coordinates system
(0,0) x
y stage
Coordinates system
(0,0) x
y
stage
(x=50,y=50)
child
Coordinates system
(0,0) x
y
stage
(x=0,y=0)
child
(x=50,y=50)
container
Loops
for (var i:uint = 0; i < 10; i++)
{
trace(i);
}
var j:uint = 0;
while(j < 10)
{
trace(j);
j++;
}
Events
card.addEventListener(MouseEvent.CLICK, onClick);
private function onClick(event:MouseEvent):void
{
trace("clicked!");
}
dispatchEvent(new Event("makeSomeNoise"));
Event bubbling
Observer pattern
Observer pattern
Arrays, Vectors, Dictonaries
var myArray:Array = [1, "2nd element"];
myArray.push(10);
myArray.push("Hello World");
myArray.push({name: "Jan", age: 37});
myArray[3]; //"Hello World"
var myVector:Vector.<int> = new Vector.<int>();
myVector.push(5);
myVector.push(10);
myVector[2]; //10
var myDictionary:Dictionary = new Dictionary();
myDictionary["someKey"] = myVector;
myDictionary["someKey"][2]; //10
Array sortng
myArray.sort();
myArray.sort(Array.DESCENDING | Array.CASEINSENSITIVE);
myArray.sortOn("depth");
myArray.sort(randomSort);
private function randomSort(a:*, b:*):Number
{
if (Math.random() < 0.5) return -1;
else return 1;
}
Conditonal statements
if(delta < 0)
{
trace("no roots")
}
else if(delta == 0)
{
trace("one root")
}
else
{
trace("two roots")
}
var absolute:Number = value >= 0 ? value : -value;
TweenMax
TweenMax.to(
card,
.5,
{
scaleX: 1.2,
scaleY: 1.2,
delay: 1,
ease: Elastic.easeIn,
onComplete: completeFunction
}
);
Tasks
● Blocking card choice during tmeout
● Blocking picking up the same card twice
● Enlarging card after mouse over
● Disappearing animaton of correctly chosen cards
● 3D Card rotaton (hint: TweenMax, rotationY,
onUpdate)

More Related Content

Similar to An Introduction to Game Programming with Flash: An Introduction to Flash and Action Script 3

Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
FIWARE
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Jim Tochterman
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 

Similar to An Introduction to Game Programming with Flash: An Introduction to Flash and Action Script 3 (20)

A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
 
Securing TodoMVC Using the Web Cryptography API
Securing TodoMVC Using the Web Cryptography APISecuring TodoMVC Using the Web Cryptography API
Securing TodoMVC Using the Web Cryptography API
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
 
Android game development
Android game developmentAndroid game development
Android game development
 
From newbie to ...
From newbie to ...From newbie to ...
From newbie to ...
 
Using Android Things to Detect & Exterminate Reptilians
Using Android Things to Detect & Exterminate ReptiliansUsing Android Things to Detect & Exterminate Reptilians
Using Android Things to Detect & Exterminate Reptilians
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Talk about html5 security
Talk about html5 securityTalk about html5 security
Talk about html5 security
 
A miało być tak... bez wycieków
A miało być tak... bez wyciekówA miało być tak... bez wycieków
A miało być tak... bez wycieków
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 Apps
 
How to make a video game
How to make a video gameHow to make a video game
How to make a video game
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
The Ring programming language version 1.5.3 book - Part 15 of 184
The Ring programming language version 1.5.3 book - Part 15 of 184The Ring programming language version 1.5.3 book - Part 15 of 184
The Ring programming language version 1.5.3 book - Part 15 of 184
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO Time
 

Recently uploaded

Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Recently uploaded (20)

Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 

An Introduction to Game Programming with Flash: An Introduction to Flash and Action Script 3