SlideShare a Scribd company logo
1 of 17
Download to read offline
An Introducton to Game
Programming with Flash
2. Object Oriented Programming
What is O-O?
Researching problem from a perspectve of:
● Objects
● Dependencies
● Relatons
What can be O-O?
● Analysis
● Design
● Programming
Why O-O?
Easier:
● Analysis
● Design
● Programming and maintenance
Why is it so important?
package foo
{
public class Person
{
private var name:String;
public function Person(name:String)
{
this.name = name;
}
public function introduce():String
{
return "My name is " + name;
}
}
}
1
2
3
4
5
Class
import foo.Person;
var person:Person = new Person("John Smith");
person.introduce(); //My name is John Smith
1
2
Object
package foo
{
public class Rapper extends Person
{
public function Rapper(name:String)
{
super(name);
}
}
}
import foo.Rapper;
var snoopDog:Rapper = new Rapper("Snoop Dogg");
snoopDog.introduce(); //My name is Snoop Dogg
1
2
3
Inheritance
package foo
{
public class Rapper extends Person
{
public function Rapper(name:String)
{
super(name);
}
override public function introduce():String
{
return "YO! " + super.introduce();
}
}
}
import foo.Rapper;
var snoopDog:Rapper = new Rapper("Snoop Dogg");
snoopDog.introduce(); //YO! My name is Snoop Dogg
2
3
Polymorphism
1
Enakpsulaton
Hiding implementaton and exposing only desired API
Access modifiers:
● public – for everyone
● protected – only for the same class or subclasses
● internal – only for the same package
● private – only the same class
Interface
package foo
{
public interface IPerson
{
function introduce():String;
}
}
1
2
Statc fields and methods
package foo
{
public class Math
{
public static const PI:Number = 3.14;
public static function abs(value:Number):Number
{
return (value >= 0) ? value : -value;
}
}
}
Math.PI; //3.14
Math.abs(-5); //5
1
2
3
Good practces
● Single Responsibility Principle
● Open/Closed Principle
● Liskov Substtuton Principle
● Interface Segregaton Principle
● Dependency Inversion Principle
● ...
● Don't Repeat Yourself
● Law of Demeter
● ...
● COMMON SENCE!
Jet&Giant
git clone git://github.com/krzysztof-o/epi-
wdpg.git
Jet&Giant
Task 1
Moving a Giant:
● Giant can move horizontally and vertcally
● smoothing
Task 2
Enemies:
● Two classes should inherit from Enemy
● Enemy_1 moves quickly, along straight line
● Enemy_1 need single hit to be destroyed
● Enemy_2 moves slowly, along sine wave
● Enemy_2 needs double hit to be destroyed
enemy_1 enemy_2
Task 3
Giant – Enemy collision:
● Collision causes showing boom animaton
● Collision takes one Giant's life
Task 4
Shootng enemies:
● Enemies can shoot with random frequency
● Hitting Giant with bullet takes one life

More Related Content

What's hot

Dive into Pinkoi 2013
Dive into Pinkoi 2013Dive into Pinkoi 2013
Dive into Pinkoi 2013Mosky Liu
 
Collaborative Software Development
Collaborative Software DevelopmentCollaborative Software Development
Collaborative Software DevelopmentAlexander Serebrenik
 
[Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012][Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012]Mumbai B.Sc.IT Study
 

What's hot (6)

Dive into Pinkoi 2013
Dive into Pinkoi 2013Dive into Pinkoi 2013
Dive into Pinkoi 2013
 
Cryptography
CryptographyCryptography
Cryptography
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Collaborative Software Development
Collaborative Software DevelopmentCollaborative Software Development
Collaborative Software Development
 
DLR MCQs
DLR MCQsDLR MCQs
DLR MCQs
 
[Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012][Question Paper] Network Security (Revised Syllabus) [October / 2012]
[Question Paper] Network Security (Revised Syllabus) [October / 2012]
 

Viewers also liked

The history of Flash
The history of FlashThe history of Flash
The history of FlashMaso Lin
 
АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...
АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...
АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...Tangarr Forgart
 
Learning flash by Ms. Payal Narula
Learning flash by Ms. Payal Narula Learning flash by Ms. Payal Narula
Learning flash by Ms. Payal Narula kulachihansraj
 
Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)Matteo Wyllyamz
 

Viewers also liked (6)

Flash8
Flash8Flash8
Flash8
 
The history of Flash
The history of FlashThe history of Flash
The history of Flash
 
АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...
АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...
АКТУАЛЬНО СОЦИО-ЭКОНОМИЧЕСКОЕ ПОЛОЖЕНИЕ ТРАНСГЕНДЕРНЫХ И КВИР ЛЮДЕЙ НА ПОСТСО...
 
Learning flash by Ms. Payal Narula
Learning flash by Ms. Payal Narula Learning flash by Ms. Payal Narula
Learning flash by Ms. Payal Narula
 
English
EnglishEnglish
English
 
Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)
 

Similar to An Introduction to Game Programming with Flash: Object Oriented Programming

Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerGarth Gilmour
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerGarth Gilmour
 
Introduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoIntroduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoMuhammad Abdullah
 
On deriving the private key from a public key
On deriving the private key from a public keyOn deriving the private key from a public key
On deriving the private key from a public keyDharmalingam Ganesan
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Codemotion
 
Implementation of oop concept in c++
Implementation of oop concept in c++Implementation of oop concept in c++
Implementation of oop concept in c++Swarup Kumar Boro
 
The mighty js_function
The mighty js_functionThe mighty js_function
The mighty js_functiontimotheeg
 
Embedded Rust and more
Embedded Rust and moreEmbedded Rust and more
Embedded Rust and moreKiwamu Okabe
 
Design Patterns in Game Programming
Design Patterns in Game ProgrammingDesign Patterns in Game Programming
Design Patterns in Game ProgrammingBruno Cicanci
 
Python-GTK
Python-GTKPython-GTK
Python-GTKYuren Ju
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Robert Stern
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Yuren Ju
 
Design patterns
Design patternsDesign patterns
Design patternsBa Tran
 
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija SiskoTrivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija SiskoTrivadis
 
Spinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment CommunicationSpinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment CommunicationCITSimon
 

Similar to An Introduction to Game Programming with Flash: Object Oriented Programming (20)

Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
05. haskell streaming io
05. haskell streaming io05. haskell streaming io
05. haskell streaming io
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
 
Introduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoIntroduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demo
 
On deriving the private key from a public key
On deriving the private key from a public keyOn deriving the private key from a public key
On deriving the private key from a public key
 
Class or Object
Class or ObjectClass or Object
Class or Object
 
Lecture5
Lecture5Lecture5
Lecture5
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
 
Implementation of oop concept in c++
Implementation of oop concept in c++Implementation of oop concept in c++
Implementation of oop concept in c++
 
The mighty js_function
The mighty js_functionThe mighty js_function
The mighty js_function
 
Embedded Rust and more
Embedded Rust and moreEmbedded Rust and more
Embedded Rust and more
 
Kotlin
KotlinKotlin
Kotlin
 
Design Patterns in Game Programming
Design Patterns in Game ProgrammingDesign Patterns in Game Programming
Design Patterns in Game Programming
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija SiskoTrivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
Trivadis TechEvent 2016 Go - The Cloud Programming Language by Andija Sisko
 
Spinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment CommunicationSpinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment Communication
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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)wesley chun
 
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 organizationRadu Cotescu
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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 RobisonAnna Loughnan Colquhoun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 educationjfdjdjcjdnsjd
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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...Miguel Araújo
 
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 AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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)
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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...
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

An Introduction to Game Programming with Flash: Object Oriented Programming

  • 1. An Introducton to Game Programming with Flash 2. Object Oriented Programming
  • 2. What is O-O? Researching problem from a perspectve of: ● Objects ● Dependencies ● Relatons What can be O-O? ● Analysis ● Design ● Programming
  • 3. Why O-O? Easier: ● Analysis ● Design ● Programming and maintenance Why is it so important?
  • 4. package foo { public class Person { private var name:String; public function Person(name:String) { this.name = name; } public function introduce():String { return "My name is " + name; } } } 1 2 3 4 5 Class
  • 5. import foo.Person; var person:Person = new Person("John Smith"); person.introduce(); //My name is John Smith 1 2 Object
  • 6. package foo { public class Rapper extends Person { public function Rapper(name:String) { super(name); } } } import foo.Rapper; var snoopDog:Rapper = new Rapper("Snoop Dogg"); snoopDog.introduce(); //My name is Snoop Dogg 1 2 3 Inheritance
  • 7. package foo { public class Rapper extends Person { public function Rapper(name:String) { super(name); } override public function introduce():String { return "YO! " + super.introduce(); } } } import foo.Rapper; var snoopDog:Rapper = new Rapper("Snoop Dogg"); snoopDog.introduce(); //YO! My name is Snoop Dogg 2 3 Polymorphism 1
  • 8. Enakpsulaton Hiding implementaton and exposing only desired API Access modifiers: ● public – for everyone ● protected – only for the same class or subclasses ● internal – only for the same package ● private – only the same class
  • 9. Interface package foo { public interface IPerson { function introduce():String; } } 1 2
  • 10. Statc fields and methods package foo { public class Math { public static const PI:Number = 3.14; public static function abs(value:Number):Number { return (value >= 0) ? value : -value; } } } Math.PI; //3.14 Math.abs(-5); //5 1 2 3
  • 11. Good practces ● Single Responsibility Principle ● Open/Closed Principle ● Liskov Substtuton Principle ● Interface Segregaton Principle ● Dependency Inversion Principle ● ... ● Don't Repeat Yourself ● Law of Demeter ● ... ● COMMON SENCE!
  • 14. Task 1 Moving a Giant: ● Giant can move horizontally and vertcally ● smoothing
  • 15. Task 2 Enemies: ● Two classes should inherit from Enemy ● Enemy_1 moves quickly, along straight line ● Enemy_1 need single hit to be destroyed ● Enemy_2 moves slowly, along sine wave ● Enemy_2 needs double hit to be destroyed enemy_1 enemy_2
  • 16. Task 3 Giant – Enemy collision: ● Collision causes showing boom animaton ● Collision takes one Giant's life
  • 17. Task 4 Shootng enemies: ● Enemies can shoot with random frequency ● Hitting Giant with bullet takes one life