SlideShare a Scribd company logo
1 of 50
BUCC Toy
Project:
Angry Jolly Birds
in 3D (3D game)
With
Md. Sadaf Noor (@sadaf2605)
www.sadafnoor.tk/
PROJECT DETAILS
This is the Desktop 3D version of the game
Angry Birds. The complete work of this project
is and will be done under the flagship of BRAC
University Computer Club by a team
comprising of bunch of first semester students
and a mentor of BRAC University and BRAC
University Computer Club.
Repository:
https://github.com/sadaf2605/AngryJollyBirds3D
Want to be a part of the journey?
Welcome aboard!
If you are following this series of tutorial and want
to contribute, then we would also love to work with
you. If you are a new coder like other contributor of
this project, then you are welcoming you more
coordinately.
You can either contact with me (
sadaf2605@gmail.com) with your code or you can
directly send pull request to our github repository
mentioned in the previous page.
Download, Install, Open JME3
1. Download it.
Download Link:
http://hub.jmonkeyengine.org/downloads/
2. Install it and
3. Then open it
• File> New Project…
Category: JME3
Project: BasicGame
Next
Project name of your choice
Finish
Click:
Your Project name> Source Packages>mygame> main.java
Left click on .java > Properties >
Write new name
ENTER
0. Creating a box
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat); // set the cube's material
rootNode.attachChild(geom); // make the cube appear in the scene
}}
1. Importing packages
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
1. Importing packages
• When we put 2 files in a same directory, java
can find it easily
• But it fails when we use files of multiple
directory, so we need to import directory.
• Packages are just directories that contains
the location where the class is located.
• Just like Scanner, it is located in
java.util.Scanner directory, so we import it in
the beginning of the file.
2. Extending what?
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
}
2. Extending what?
2. Inheritance
2. Inheritance
• But the problem with our social life
inheritance is that if father posses 5 bundle of
coins then each of the 5 son will get 1 bundle
of coins.
• Inheritance in programming languages are
more broad minded, it gives everything of the
father to each and every child
• So probably we should introduce a new
example, shall we?
2. Inheritance
2. Inheritance
Probably the Land phone that located in your
house is an example. Which can be used by
other members of the family.
2. Inheritance
2. Inheritance
I am moving my arrows 180’ because since
parent has nothing to lose in inheritance parent
does not care who is inheriting him. So its
child’s responsibility to chose a good parent(!).
2. Inheritance
2. Inheritance
2. Inheritance
So after inheriting every child and their parent
will have their own phone at the same time.
By the way, if one child destroy the phone but
yet other user won’t get disturbed by it so it is
all alike of using own phone.
2. Inheritance (why?)
“We have more in common as humans than
difference”
2 point to note:
i) Common
ii)Difference
2. Inheritance (why?)
name
age
hobby
job
haveFun()
Gossip() name
age
hobby
job
haveFun()
Gossip()
name
age
hobby
job
haveFun()
Gossip()
name
age
hobby
job
haveFun()
Gossip()
name
age
hobby
job
haveFun()
Gossip()
Karate
skill money
Fix()
arrest() speed
2. Inheritance (why?)
name
age
hobby
job
haveFun()
Gossip() name
age
hobby
job
haveFun()
Gossip()
name
age
hobby
job
haveFun()
Gossip()
name
age
hobby
job
haveFun()
Gossip()
name
age
hobby
job
haveFun()
Gossip()
2. Inheritance (why?)
Lets generalize all the common things
together in a super class, in the parent class
and let’s put all the specialization in the sub
class, in the child class.
It will help us to DRY out(Do not Repeat
Yourself) our code.
2. Inheritance (why?)
name
age
hobby
job
haveFun()
Gossip()
Karate
skill money
Fix()
arrest() speed
2. Inheritance (how?)
2. Inheritance (how?)
public class parent{
int parentVariable=0;
void parentMethod(){
System.out.println(“Shouting…….”);
}
}
2. Inheritance (how?)
public class child{
int childVariable=0;
void childMethod(){
System.out.println(“Please, please, please…….”);
}
}
2. Inheritance (how?)
public class parent{
int parentVariable=0;
void parentMethod(){
System.out.println(“Shouting…….”);
}
}
public class child{
int childVariable=0;
void childMethod(){
System.out.println(“Please, please, please…….”);
}
}
2. Inheritance (how?)
public class parent{
int parentVariable=0;
void parentMethod(){
System.out.println(“Shouting…….”);
}
}
public class child{
int childVariable=0;
void childMethod(){
System.out.println(“Please, please, please…….”);
}
}
2. Inheritance (how?)
public class child extends parent{
int childVariable=0;
void childMethod(){
System.out.println(“Please, please,
please…….”);
}
public static void main(String [] args){
//call any parent method you want.
}
}
3. Adding methods
Import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
}
}
3. Adding methods
•Void main method always leads
public static void main(String[] args){
}
•Other method like this follow its
order from the main methods.
public void simpleInitApp() {
}
4. Instantiate to start
Import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
}
4. Instantiate to start
What we do when we need to access
Scanner.class?
•We make instance of it:
Scanner sc= new Scanner(……)
•Then we use its method:
sc.nextInt()
•The same trick
HelloJME3 app = new HelloJME3();
app.start(); // start the game
4. Instantiate to start
So how would we access to our
HelloJME3.class?
•We make instance of it:
HelloJME3 app = new HelloJME3();
•Then we use its method:
app.start(); // start the game
5. Adding Geometry
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
}}
5. Adding Geometry
Geometry geom = new Geometry("Box",
b);
Geometry manages all the rendering
information such as the material type, how
the surface should be shaded and the mesh
data such as points, lines, faces and maybe
altogether.
BUT b is not defined! What is b? Mesh!
6. Adding Mesh
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
}}
6. Adding Mesh
Mesh is used to store rendering data. It is a
collection of vertices along with data about
how the are connected to each other and
the faces they form. In fact all visible
elements in a scene are represented
by meshes.
One kind of Mesh is box.
Box b = new Box(Vector3f.ZERO, 1, 1,
6. Adding Mesh
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
7. Adding to rootNode
Everything you initialize and attach to the
rootNode in the simpleInitApp().
simpleInitApp() method is part of the scene at
the start of the game. You can rotate,
translate, and scale objects by manipulating
their parent nodes. The Root Node is special:
Only what is attached to the Root Node
appears in the scene.
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
rootNode.attachChild(geom); // make the cube appear in the scene
}}
7. Defining Material
Material definitions provide the "logic" for the
materials. Usually a shader that will handle
drawing the object, and corresponding
parameters that allow configuration of the
shader. Material definitions can be created
through J3MD files. The J3MD file abstracts
the shader and its configuration away from
the user, allowing a simple interface where
one can simply set a few parameters on the
material to change its appearance and the
way its handled.
7. Adding Material
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
geom.setMaterial(mat); // set the cube's material
rootNode.attachChild(geom); // make the cube appear in the scene
}}
8. Setting a property to Material
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args){
HelloJME3 app = new HelloJME3();
app.start(); // start the game
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat); // set the cube's material
rootNode.attachChild(geom); // make the cube appear in the scene
}}

More Related Content

Similar to Bucc Toy Project: Learn programming through Game Development

Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 QuizzesSteven Luo
 
Rummaging in the clOOset
Rummaging in the clOOsetRummaging in the clOOset
Rummaging in the clOOsetCurtis Poe
 
Year 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching codingYear 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching codingJoanne Villis
 
A Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and AllegroA Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and Allegrosnowfarthing
 
FITC '14 Toronto - Technology, a means to an end
FITC '14 Toronto - Technology, a means to an endFITC '14 Toronto - Technology, a means to an end
FITC '14 Toronto - Technology, a means to an endThibault Imbert
 
Technology: A Means to an End with Thibault Imbert
Technology: A Means to an End with Thibault ImbertTechnology: A Means to an End with Thibault Imbert
Technology: A Means to an End with Thibault ImbertFITC
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesGanesh Samarthyam
 
[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript
[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript
[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScriptTomomi Imura
 
Teach your kids how to program with Python and the Raspberry Pi
Teach your kids how to program with Python and the Raspberry PiTeach your kids how to program with Python and the Raspberry Pi
Teach your kids how to program with Python and the Raspberry PiJuan Gomez
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaKonrad Malawski
 
Introduction to Box2D Physics Engine
Introduction to Box2D Physics EngineIntroduction to Box2D Physics Engine
Introduction to Box2D Physics Enginefirstthumb
 
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial DetectionTomomi Imura
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Peter Higgins
 
Java Puzzlers NG as it was presented at Detroit Java User Group
Java Puzzlers NG as it was presented at Detroit Java User GroupJava Puzzlers NG as it was presented at Detroit Java User Group
Java Puzzlers NG as it was presented at Detroit Java User GroupBaruch Sadogursky
 
Copy of repast javagettingstarted
Copy of repast javagettingstartedCopy of repast javagettingstarted
Copy of repast javagettingstartedNimish Verma
 

Similar to Bucc Toy Project: Learn programming through Game Development (20)

Java exercise1
Java exercise1Java exercise1
Java exercise1
 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 Quizzes
 
Rummaging in the clOOset
Rummaging in the clOOsetRummaging in the clOOset
Rummaging in the clOOset
 
Year 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching codingYear 5-6: Ideas for teaching coding
Year 5-6: Ideas for teaching coding
 
A Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and AllegroA Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and Allegro
 
FITC '14 Toronto - Technology, a means to an end
FITC '14 Toronto - Technology, a means to an endFITC '14 Toronto - Technology, a means to an end
FITC '14 Toronto - Technology, a means to an end
 
Technology: A Means to an End with Thibault Imbert
Technology: A Means to an End with Thibault ImbertTechnology: A Means to an End with Thibault Imbert
Technology: A Means to an End with Thibault Imbert
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript
[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript
[Longer ver] From Software to Hardware: How Do I Track My Cat with JavaScript
 
Teach your kids how to program with Python and the Raspberry Pi
Teach your kids how to program with Python and the Raspberry PiTeach your kids how to program with Python and the Raspberry Pi
Teach your kids how to program with Python and the Raspberry Pi
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
 
Introduction to Box2D Physics Engine
Introduction to Box2D Physics EngineIntroduction to Box2D Physics Engine
Introduction to Box2D Physics Engine
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
 
Core Java - Quiz Questions - Bug Hunt
Core Java - Quiz Questions - Bug HuntCore Java - Quiz Questions - Bug Hunt
Core Java - Quiz Questions - Bug Hunt
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
Java Puzzlers NG as it was presented at Detroit Java User Group
Java Puzzlers NG as it was presented at Detroit Java User GroupJava Puzzlers NG as it was presented at Detroit Java User Group
Java Puzzlers NG as it was presented at Detroit Java User Group
 
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
 
Copy of repast javagettingstarted
Copy of repast javagettingstartedCopy of repast javagettingstarted
Copy of repast javagettingstarted
 

Recently uploaded

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 

Recently uploaded (20)

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

Bucc Toy Project: Learn programming through Game Development

  • 1. BUCC Toy Project: Angry Jolly Birds in 3D (3D game) With Md. Sadaf Noor (@sadaf2605) www.sadafnoor.tk/
  • 2. PROJECT DETAILS This is the Desktop 3D version of the game Angry Birds. The complete work of this project is and will be done under the flagship of BRAC University Computer Club by a team comprising of bunch of first semester students and a mentor of BRAC University and BRAC University Computer Club. Repository: https://github.com/sadaf2605/AngryJollyBirds3D
  • 3. Want to be a part of the journey? Welcome aboard! If you are following this series of tutorial and want to contribute, then we would also love to work with you. If you are a new coder like other contributor of this project, then you are welcoming you more coordinately. You can either contact with me ( sadaf2605@gmail.com) with your code or you can directly send pull request to our github repository mentioned in the previous page.
  • 4. Download, Install, Open JME3 1. Download it. Download Link: http://hub.jmonkeyengine.org/downloads/ 2. Install it and 3. Then open it
  • 5. • File> New Project…
  • 7. Project name of your choice Finish
  • 8. Click: Your Project name> Source Packages>mygame> main.java
  • 9. Left click on .java > Properties >
  • 11. 0. Creating a box import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Geometry geom = new Geometry("Box", b); // create cube geometry from the shape Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue geom.setMaterial(mat); // set the cube's material rootNode.attachChild(geom); // make the cube appear in the scene }}
  • 12. 1. Importing packages import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA;
  • 13. 1. Importing packages • When we put 2 files in a same directory, java can find it easily • But it fails when we use files of multiple directory, so we need to import directory. • Packages are just directories that contains the location where the class is located. • Just like Scanner, it is located in java.util.Scanner directory, so we import it in the beginning of the file.
  • 14. 2. Extending what? import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { }
  • 17. 2. Inheritance • But the problem with our social life inheritance is that if father posses 5 bundle of coins then each of the 5 son will get 1 bundle of coins. • Inheritance in programming languages are more broad minded, it gives everything of the father to each and every child • So probably we should introduce a new example, shall we?
  • 19. 2. Inheritance Probably the Land phone that located in your house is an example. Which can be used by other members of the family.
  • 21. 2. Inheritance I am moving my arrows 180’ because since parent has nothing to lose in inheritance parent does not care who is inheriting him. So its child’s responsibility to chose a good parent(!).
  • 24. 2. Inheritance So after inheriting every child and their parent will have their own phone at the same time. By the way, if one child destroy the phone but yet other user won’t get disturbed by it so it is all alike of using own phone.
  • 25. 2. Inheritance (why?) “We have more in common as humans than difference” 2 point to note: i) Common ii)Difference
  • 26. 2. Inheritance (why?) name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() Karate skill money Fix() arrest() speed
  • 27. 2. Inheritance (why?) name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip() name age hobby job haveFun() Gossip()
  • 28. 2. Inheritance (why?) Lets generalize all the common things together in a super class, in the parent class and let’s put all the specialization in the sub class, in the child class. It will help us to DRY out(Do not Repeat Yourself) our code.
  • 31. 2. Inheritance (how?) public class parent{ int parentVariable=0; void parentMethod(){ System.out.println(“Shouting…….”); } }
  • 32. 2. Inheritance (how?) public class child{ int childVariable=0; void childMethod(){ System.out.println(“Please, please, please…….”); } }
  • 33. 2. Inheritance (how?) public class parent{ int parentVariable=0; void parentMethod(){ System.out.println(“Shouting…….”); } } public class child{ int childVariable=0; void childMethod(){ System.out.println(“Please, please, please…….”); } }
  • 34. 2. Inheritance (how?) public class parent{ int parentVariable=0; void parentMethod(){ System.out.println(“Shouting…….”); } } public class child{ int childVariable=0; void childMethod(){ System.out.println(“Please, please, please…….”); } }
  • 35. 2. Inheritance (how?) public class child extends parent{ int childVariable=0; void childMethod(){ System.out.println(“Please, please, please…….”); } public static void main(String [] args){ //call any parent method you want. } }
  • 36. 3. Adding methods Import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ } }
  • 37. 3. Adding methods •Void main method always leads public static void main(String[] args){ } •Other method like this follow its order from the main methods. public void simpleInitApp() { }
  • 38. 4. Instantiate to start Import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } }
  • 39. 4. Instantiate to start What we do when we need to access Scanner.class? •We make instance of it: Scanner sc= new Scanner(……) •Then we use its method: sc.nextInt() •The same trick HelloJME3 app = new HelloJME3(); app.start(); // start the game
  • 40. 4. Instantiate to start So how would we access to our HelloJME3.class? •We make instance of it: HelloJME3 app = new HelloJME3(); •Then we use its method: app.start(); // start the game
  • 41. 5. Adding Geometry import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Geometry geom = new Geometry("Box", b); // create cube geometry from the shape }}
  • 42. 5. Adding Geometry Geometry geom = new Geometry("Box", b); Geometry manages all the rendering information such as the material type, how the surface should be shaded and the mesh data such as points, lines, faces and maybe altogether. BUT b is not defined! What is b? Mesh!
  • 43. 6. Adding Mesh import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Geometry geom = new Geometry("Box", b); // create cube geometry from the shape }}
  • 44. 6. Adding Mesh Mesh is used to store rendering data. It is a collection of vertices along with data about how the are connected to each other and the faces they form. In fact all visible elements in a scene are represented by meshes. One kind of Mesh is box. Box b = new Box(Vector3f.ZERO, 1, 1,
  • 45. 6. Adding Mesh import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
  • 46. 7. Adding to rootNode Everything you initialize and attach to the rootNode in the simpleInitApp(). simpleInitApp() method is part of the scene at the start of the game. You can rotate, translate, and scale objects by manipulating their parent nodes. The Root Node is special: Only what is attached to the Root Node appears in the scene.
  • 47. import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Geometry geom = new Geometry("Box", b); // create cube geometry from the shape Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material rootNode.attachChild(geom); // make the cube appear in the scene }}
  • 48. 7. Defining Material Material definitions provide the "logic" for the materials. Usually a shader that will handle drawing the object, and corresponding parameters that allow configuration of the shader. Material definitions can be created through J3MD files. The J3MD file abstracts the shader and its configuration away from the user, allowing a simple interface where one can simply set a few parameters on the material to change its appearance and the way its handled.
  • 49. 7. Adding Material import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Geometry geom = new Geometry("Box", b); // create cube geometry from the shape Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material geom.setMaterial(mat); // set the cube's material rootNode.attachChild(geom); // make the cube appear in the scene }}
  • 50. 8. Setting a property to Material import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.math.ColorRGBA; public class HelloJME3 extends SimpleApplication { public static void main(String[] args){ HelloJME3 app = new HelloJME3(); app.start(); // start the game } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Geometry geom = new Geometry("Box", b); // create cube geometry from the shape Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue geom.setMaterial(mat); // set the cube's material rootNode.attachChild(geom); // make the cube appear in the scene }}