SlideShare a Scribd company logo
OOP Game
Programming
Concept
Hello!
I am
Satriyo Aji Nugroho
You can find me at:
acttogreen@Gmail.com
Or contact me :
+62895371034583
But First,
Lets Learn Game Mechanic
Oop Game Programming Concept
Oop Game Programming Concept
OBJECT HIERARCHY
OBJECT HIERARCHY
OBJECT HIERARCHY
Ada 4 jenis Style Programming :
oProcedural
oObject Oriented
oFunctional
oModular
Apa itu OOP ?
“Pemrograman berorientasi objek yang
berfokus pada pemecahan dan perilaku
objek yang dipelajari”
3 konsep dasar Object Oriented
✖Encapsulation
✖Abstraction
✖Inheritance
Breakdown & Implementation
(Asteroids, Tetris & Pacman)
Cohesion
“Grouping together code that
contributes to a single task”
ASTEROIDS (1979)
/**
* Class Pesawat
*/
public class Ship {
/**
* Function – performs the behavior (task) of turning the Ship
*/
public void rotate() {
// Code that turns the ship
}
/**
* Function – performs the behavior (task) of moving the Ship
*/
public void move() {
// Code that moves the ship
}
/**
* Function – performs the behavior (task) of firing the Ship's gun
*/
public void fire() {
// Code that makes the ship fire a bullet
}
}
CODE IMPLEMENTATION
(ASTEROIDS)
TETRIS (1984)
CODE IMPLEMENTATION
(TETRIS)
/**
* Class Tetris
*/
public class Tetromino {
/**
* Function – update a Tetromino's position
*/
public void fall() {
// Code that updates the Tetromino's position
}
/**
* Function - move a Tetromino
*/
public void move() {
// Code that moves the Tetromino sideways
}
/**
* Function – rotate a Tetromino
*/
public void rotate() {
// Code that rotates the Tetromino by 90 degrees
}
}
PACMAN (1980)
CODE IMPLEMENTATION
(PACMAN)
/**
* Class Hantu
*/
public class Ghost {
/**
* Function – moves the Ghost
*/
public void move() {
// Code that moves the ghost in the current direction
}
/**
* Function - change Ghost direction
*/
public void changeDirection() {
// Code that changes the Ghost's direction
}
/**
* Function – change Ghost speed
*/
public void changeSpeed() {
// Code that changes the Ghost's speed
}
/**
* Function – change Ghost color
*/
public void changeColor() {
// Code that changes the Ghost's color
}
/**
* Function – change Ghost state
*/
public void changeState() {
// Code that changes the Ghost's state
// This function also will call the three functions of changeDirection, changeSpeed, and changeColor
}
}
Encapsulation
“Encapsulation is the principle of
information hiding.”
CODE IMPLEMENTATION
(Encapsulation Class
PACMAN)
public class Ghost {
// Ghost states
private String color;
private String name;
private Boolean isEatable;
private Vector direction;
private int speed;
Pada Class Ghost terdapat method Move ( ),
ChangeSpeed ( ),dst
Proses encapsulation akan membundle variable yang
diperlukan menjadi satu class, sehingga harus memakai
acces modifier “private” yang nantinya akan dipanggil
pada method yang diinginkan.
Abstraction
“Abstraction is the principle of
generalization”
CODE IMPLEMENTATION
(Abstract Class)
/**
* Abstract class for moving
*/
abstract class Movable {
public float velocityX;
public float velocityY;
public float positionX;
public float positionY;
/**
* Function – performs the behavior (task) of moving the Ship
*/
public void move() {
positionX += velocityX;
positionY += velocityY;
}
}
Pengunaan Abstraction dipakai jika sebuah objek memiliki keserupaan
dengan objek lainnya, sebagai contoh pada game Asteroids, class
ship,enemy dan asteroid memiliki satu method yang sama yaitu, Move ()
berisi variable pergerakan velocity X,Y & Pos X,Y sehingga hanya
memerlukan satu class sebagai refrence
Inheritance
“Inheritance is the principle of class
hierarchy”
CODE IMPLEMENTATION
(Inheritance)
Inheritance merupakan konsep OOP dengan memakai sistem hirarki.
Pada Class sebelumnya, sudah terdapat Abstract class Movable
(Superclass) yang dipanggil pada class Ship (Subclass) nantinya class
Ship akan memakai method pada abstract class pada class Movable.
/**
* The Ship Class
*/
public class Ship extends Movable {
/**
* Function to rotate the ship
*/
public void rotate() {
// Code that turns the ship
}
/**
* Function to fire
*/
public void fire() {
// Code to fire
}
}
Start Pitching
&
Create Your own Game

More Related Content

PPTX
Polymorphism presentation in java
PDF
PPTX
Development of Mobile Application -PPT
PPTX
PDF
Android Programming Basics
PPT
Mobile application development
PDF
API Testing
PDF
Android Platform Architecture
Polymorphism presentation in java
Development of Mobile Application -PPT
Android Programming Basics
Mobile application development
API Testing
Android Platform Architecture

What's hot (20)

PPT
Introduction to the Web API
PDF
Model View Controller (MVC)
PPTX
Training on Core java | PPT Presentation | Shravan Sanidhya
PPTX
Day: 1 Introduction to Mobile Application Development (in Android)
PPTX
Java Multi Thead Programming
PPT
Java tutorial PPT
ODP
Basic of Java
PDF
PPTX
Introduction to Spring Framework
PPTX
Api testing
PDF
Polymorphism in oop
PPTX
User interface (UI) for mobile applications
PPTX
What is an API?
PDF
Android Telephony Manager and SMS
PDF
PPTX
Coding standards
PPTX
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
PDF
Importance of Mobile Applications
PPTX
Introduction To Mobile Application Development
Introduction to the Web API
Model View Controller (MVC)
Training on Core java | PPT Presentation | Shravan Sanidhya
Day: 1 Introduction to Mobile Application Development (in Android)
Java Multi Thead Programming
Java tutorial PPT
Basic of Java
Introduction to Spring Framework
Api testing
Polymorphism in oop
User interface (UI) for mobile applications
What is an API?
Android Telephony Manager and SMS
Coding standards
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
Importance of Mobile Applications
Introduction To Mobile Application Development
Ad

Similar to Oop Game Programming Concept (20)

PPTX
Advanced JavaScript
PPTX
04 Java Language And OOP Part IV
PDF
Scalable JavaScript Design Patterns
PDF
The mighty js_function
PPTX
OOPS features using Objective C
PPTX
pert.3&4.pptx
PDF
How AngularJS Embraced Traditional Design Patterns
DOCX
Abstraction Techniques untuk kelas Pemrograman Obyek Java.docx
PDF
Java design patterns
PPTX
Awesomeness of JavaScript…almost
DOCX
Using traits in PHP
PDF
Object Oriented Programming in JavaScript
PDF
Kotlin from-scratch 3 - coroutines
PDF
Everything is Permitted: Extending Built-ins
KEY
Grand Central Dispatch Design Patterns
KEY
Learning iOS and hunting NSZombies in 3 weeks
PDF
Koin Quickstart
PDF
Mastering OOP: Understanding the Four Core Pillars
PPTX
Modeling Patterns for JavaScript Browser-Based Games
PPTX
Ocl 09
Advanced JavaScript
04 Java Language And OOP Part IV
Scalable JavaScript Design Patterns
The mighty js_function
OOPS features using Objective C
pert.3&4.pptx
How AngularJS Embraced Traditional Design Patterns
Abstraction Techniques untuk kelas Pemrograman Obyek Java.docx
Java design patterns
Awesomeness of JavaScript…almost
Using traits in PHP
Object Oriented Programming in JavaScript
Kotlin from-scratch 3 - coroutines
Everything is Permitted: Extending Built-ins
Grand Central Dispatch Design Patterns
Learning iOS and hunting NSZombies in 3 weeks
Koin Quickstart
Mastering OOP: Understanding the Four Core Pillars
Modeling Patterns for JavaScript Browser-Based Games
Ocl 09
Ad

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
medical staffing services at VALiNTRY
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Introduction to Artificial Intelligence
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPT
Introduction Database Management System for Course Database
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
top salesforce developer skills in 2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Odoo Companies in India – Driving Business Transformation.pdf
Softaken Excel to vCard Converter Software.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
Digital Systems & Binary Numbers (comprehensive )
How to Choose the Right IT Partner for Your Business in Malaysia
Adobe Illustrator 28.6 Crack My Vision of Vector Design
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
medical staffing services at VALiNTRY
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
CHAPTER 2 - PM Management and IT Context
Introduction to Artificial Intelligence
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Introduction Database Management System for Course Database
Navsoft: AI-Powered Business Solutions & Custom Software Development
top salesforce developer skills in 2025.pdf

Oop Game Programming Concept

  • 2. Hello! I am Satriyo Aji Nugroho You can find me at: acttogreen@Gmail.com Or contact me : +62895371034583
  • 3. But First, Lets Learn Game Mechanic
  • 9. Ada 4 jenis Style Programming : oProcedural oObject Oriented oFunctional oModular
  • 11. “Pemrograman berorientasi objek yang berfokus pada pemecahan dan perilaku objek yang dipelajari”
  • 12. 3 konsep dasar Object Oriented ✖Encapsulation ✖Abstraction ✖Inheritance
  • 14. Cohesion “Grouping together code that contributes to a single task”
  • 16. /** * Class Pesawat */ public class Ship { /** * Function – performs the behavior (task) of turning the Ship */ public void rotate() { // Code that turns the ship } /** * Function – performs the behavior (task) of moving the Ship */ public void move() { // Code that moves the ship } /** * Function – performs the behavior (task) of firing the Ship's gun */ public void fire() { // Code that makes the ship fire a bullet } } CODE IMPLEMENTATION (ASTEROIDS)
  • 18. CODE IMPLEMENTATION (TETRIS) /** * Class Tetris */ public class Tetromino { /** * Function – update a Tetromino's position */ public void fall() { // Code that updates the Tetromino's position } /** * Function - move a Tetromino */ public void move() { // Code that moves the Tetromino sideways } /** * Function – rotate a Tetromino */ public void rotate() { // Code that rotates the Tetromino by 90 degrees } }
  • 20. CODE IMPLEMENTATION (PACMAN) /** * Class Hantu */ public class Ghost { /** * Function – moves the Ghost */ public void move() { // Code that moves the ghost in the current direction } /** * Function - change Ghost direction */ public void changeDirection() { // Code that changes the Ghost's direction } /** * Function – change Ghost speed */ public void changeSpeed() { // Code that changes the Ghost's speed } /** * Function – change Ghost color */ public void changeColor() { // Code that changes the Ghost's color } /** * Function – change Ghost state */ public void changeState() { // Code that changes the Ghost's state // This function also will call the three functions of changeDirection, changeSpeed, and changeColor } }
  • 21. Encapsulation “Encapsulation is the principle of information hiding.”
  • 22. CODE IMPLEMENTATION (Encapsulation Class PACMAN) public class Ghost { // Ghost states private String color; private String name; private Boolean isEatable; private Vector direction; private int speed; Pada Class Ghost terdapat method Move ( ), ChangeSpeed ( ),dst Proses encapsulation akan membundle variable yang diperlukan menjadi satu class, sehingga harus memakai acces modifier “private” yang nantinya akan dipanggil pada method yang diinginkan.
  • 23. Abstraction “Abstraction is the principle of generalization”
  • 24. CODE IMPLEMENTATION (Abstract Class) /** * Abstract class for moving */ abstract class Movable { public float velocityX; public float velocityY; public float positionX; public float positionY; /** * Function – performs the behavior (task) of moving the Ship */ public void move() { positionX += velocityX; positionY += velocityY; } } Pengunaan Abstraction dipakai jika sebuah objek memiliki keserupaan dengan objek lainnya, sebagai contoh pada game Asteroids, class ship,enemy dan asteroid memiliki satu method yang sama yaitu, Move () berisi variable pergerakan velocity X,Y & Pos X,Y sehingga hanya memerlukan satu class sebagai refrence
  • 25. Inheritance “Inheritance is the principle of class hierarchy”
  • 26. CODE IMPLEMENTATION (Inheritance) Inheritance merupakan konsep OOP dengan memakai sistem hirarki. Pada Class sebelumnya, sudah terdapat Abstract class Movable (Superclass) yang dipanggil pada class Ship (Subclass) nantinya class Ship akan memakai method pada abstract class pada class Movable. /** * The Ship Class */ public class Ship extends Movable { /** * Function to rotate the ship */ public void rotate() { // Code that turns the ship } /** * Function to fire */ public void fire() { // Code to fire } }