SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
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)

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

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