SlideShare a Scribd company logo
1 of 28
BUCC Toy Project:
Angry Jolly Birds
in 3D (3D game)
Day II
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/Angry
JollyBirds3D
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.
Re-cap
# We are familiar with methods
# We know little bit about inheritance
# We know how to instantiate
# We have created a box using our JME3
Re-cap
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
}
}
Why are we so interested
about boxes?
Simple answer! Not only because it is so simple
to create but also because our Angry and
Jolly Birds will love to hit them more often.
Why are we so interested
about boxes?
How many boxes
are there?
Ahh.. Don’t waste
your valuable time
counting boxes…
Not less than 86
boxes there is.
But our boxes are not cool!
So lets make it cool first!
How can we make them look cool?
Changing material color to yellow?
mat.setColor("Color", ColorRGBA.Yellow);
But it is not enough cool for us, or is it? NO, IT
SIMPLY DOES NOT!
Assets
So as you can see there is a “Project Assets” in
each JME3 project by default.
To make our box beautiful we will add textures
and as you can see there is a Texture folder
in the assets directory. We will keep all the
beautiful things in this directory.
Assets
Setting today's goal
Mumit Sir always taught us to keep our goal
and our current state together side by side so
that we never get misleaded.
In fact:
“You can’t reach your goal unless you have
one”
Setting today's goal
So what’s our goal? And where are we?
Texture
Lets draw an image file similar to their box,
box.jpeg and put in the Texture directory.
Texture
There is no magic I said earlier, so it won’t
appear like this, we need to modify our code
to make it happen.
We need to get the assets and then add it with
the materials. So 2 steps:
i)Getting texture asset
ii)Adding texture to the material
Texture
i)Get the asset:
Texture t =
assetManager.loadTexture("Textures/BrickWa
ll.jpg");
ii) Adding it:
mat.setTexture("ColorMap",t);
Texture
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;
import com.jme3.texture.Texture;
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
Texture t = assetManager.loadTexture("Textures/box.jpg");
mat.setTexture("ColorMap",t);
//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
}
}
Size
Now resize our box to make it even better!
We are using this code to create a box:
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
// create cube shape at the origin
Vector3f.ZERO is the location of its origin
And rest of the 1,1,1 are its size in x,y,z
coordinate. Lets resize it 3ce in y
coordinate.
Size
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;
import com.jme3.texture.Texture;
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, 3, 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
Texture t = assetManager.loadTexture("Textures/box.jpg");
mat.setTexture("ColorMap",t);
//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
}
}
Size
Lets copy our code and give them different
variable names as otherwise it won’t work
since we already know how to change size
lets apply our knowledge. Make its width 3
times bigger in width rather than in height.
Box b = new Box(Vector3f.ZERO, 3, 1, 1);
// create cube shape at the origin
Size
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args) {
HelloJME3 app = new HelloJME3();
app.start();
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 3, 1);
Geometry geom = new Geometry("Box", b);
Box b2 = new Box(Vector3f.ZERO, 3, 1, 1);
Geometry geom2 = new Geometry("Box", b2);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture t = assetManager.loadTexture("Textures/box.jpg");
mat.setTexture("ColorMap",t);
//mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
geom2.setMaterial(mat);
rootNode.attachChild(geom2);
rootNode.attachChild(geom);
}
}
Location
It produces a cross because We forgot to
change the origin Vector3f.ZERO
Location
Vector3f.ZERO are nothing but the short
hand of writing (0,0,0) as a origin.
If we would have written instead of
Vector3f.ZERO then the origin would not
have been the same:
new Vector3f(x,y,z)
Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1);
Location
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args) {
HelloJME3 app = new HelloJME3();
app.start();
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 3, 1);
Geometry geom = new Geometry("Box", b);
Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1);
Geometry geom2 = new Geometry("Box", b2);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture t = assetManager.loadTexture("Textures/box.jpg");
mat.setTexture("ColorMap",t);
//mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
geom2.setMaterial(mat);
rootNode.attachChild(geom2);
rootNode.attachChild(geom);
}
}
Location
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args) {
HelloJME3 app = new HelloJME3();
app.start();
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 3, 1);
Geometry geom = new Geometry("Box", b);
Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1);
Geometry geom2 = new Geometry("Box", b2);
Box b3 = new Box(new Vector3f(8,0,0), 1, 3, 1);
Geometry geom3 = new Geometry("Box", b3);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture t = assetManager.loadTexture("Textures/box.jpg");
mat.setTexture("ColorMap",t);
//mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
geom2.setMaterial(mat);
geom3.setMaterial(mat);
rootNode.attachChild(geom3);
rootNode.attachChild(geom2);
It is said that:
“if you can’t make it, Fake it.”
At this moment we can’t create beautiful pigs in
the screen, we will create 3D object next time
but lets fill it with something. Maybe a sphere?
Adding Sphere
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
public class HelloJME3 extends SimpleApplication {
public static void main(String[] args) {
HelloJME3 app = new HelloJME3();
app.start();
}
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 3, 1);
Geometry geom = new Geometry("Box", b);
Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1);
Geometry geom2 = new Geometry("Box", b2);
Box b3 = new Box(new Vector3f(8,0,0), 1, 3, 1);
Geometry geom3 = new Geometry("Box", b3);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture t = assetManager.loadTexture("Textures/box.jpg");
mat.setTexture("ColorMap",t);
//mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
geom2.setMaterial(mat);
geom3.setMaterial(mat);
Material pig_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
pig_mat.setColor("Color", ColorRGBA.Green);
pig_geo.setMaterial(pig_mat);
rootNode.attachChild(pig_geo);
pig_geo.setLocalTranslation(new Vector3f(2,6,0));
rootNode.attachChild(geom3);
rootNode.attachChild(geom2);
rootNode.attachChild(geom);
}
}
Compare
“A goal properly set is halfway reached.”
-Zig Ziglar

More Related Content

Viewers also liked

Toy Project 2015
Toy Project 2015Toy Project 2015
Toy Project 2015jmori2016
 
toy business proposal
toy business proposaltoy business proposal
toy business proposalclooneyg
 
Project Report on Lego Toys
Project Report on Lego ToysProject Report on Lego Toys
Project Report on Lego ToysRohan Naik
 
toy manufacturers project report.
toy manufacturers project report.toy manufacturers project report.
toy manufacturers project report.Hagi Sahib
 
Toys "R" Us Marketing Plan
Toys "R" Us Marketing PlanToys "R" Us Marketing Plan
Toys "R" Us Marketing PlanAri Ratner
 
Business Studies (Principles of Management) Project Class 12th CBSE
Business Studies (Principles of Management) Project Class 12th CBSE Business Studies (Principles of Management) Project Class 12th CBSE
Business Studies (Principles of Management) Project Class 12th CBSE Dheeraj Kumar
 

Viewers also liked (7)

Toy Project 2015
Toy Project 2015Toy Project 2015
Toy Project 2015
 
The Toy Company
The Toy Company The Toy Company
The Toy Company
 
toy business proposal
toy business proposaltoy business proposal
toy business proposal
 
Project Report on Lego Toys
Project Report on Lego ToysProject Report on Lego Toys
Project Report on Lego Toys
 
toy manufacturers project report.
toy manufacturers project report.toy manufacturers project report.
toy manufacturers project report.
 
Toys "R" Us Marketing Plan
Toys "R" Us Marketing PlanToys "R" Us Marketing Plan
Toys "R" Us Marketing Plan
 
Business Studies (Principles of Management) Project Class 12th CBSE
Business Studies (Principles of Management) Project Class 12th CBSE Business Studies (Principles of Management) Project Class 12th CBSE
Business Studies (Principles of Management) Project Class 12th CBSE
 

Similar to Bucc Toy Project: Learn programming through Game Development

Bucc Toy Project: Learn programming through Game Development
Bucc  Toy Project: Learn programming through Game DevelopmentBucc  Toy Project: Learn programming through Game Development
Bucc Toy Project: Learn programming through Game DevelopmentSadaf Noor
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxfredharris32
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VIMax Kleiner
 
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...iMasters
 
Unity - Create a structure with primitives
Unity - Create a structure with primitivesUnity - Create a structure with primitives
Unity - Create a structure with primitivesNexusEdgesupport
 
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesCUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesSubhajit Sahu
 
3Dtexture_doc_rep
3Dtexture_doc_rep3Dtexture_doc_rep
3Dtexture_doc_repLiu Zhen-Yu
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsPatchSpace Ltd
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to RAngshuman Saha
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturingSardar Alam
 
Foundations of Programming - Java OOP
Foundations of Programming - Java OOPFoundations of Programming - Java OOP
Foundations of Programming - Java OOPFariz Darari
 
openFrameworks 007 - GL
openFrameworks 007 - GL openFrameworks 007 - GL
openFrameworks 007 - GL roxlu
 
Jetpack Compose - Hands-on February 2020
Jetpack Compose - Hands-on February 2020Jetpack Compose - Hands-on February 2020
Jetpack Compose - Hands-on February 2020Pedro Veloso
 

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

Bucc Toy Project: Learn programming through Game Development
Bucc  Toy Project: Learn programming through Game DevelopmentBucc  Toy Project: Learn programming through Game Development
Bucc Toy Project: Learn programming through Game Development
 
Make a match3
Make a match3Make a match3
Make a match3
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
 
Python Puzzlers
Python PuzzlersPython Puzzlers
Python Puzzlers
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
 
Unity - Create a structure with primitives
Unity - Create a structure with primitivesUnity - Create a structure with primitives
Unity - Create a structure with primitives
 
WebGL and three.js
WebGL and three.jsWebGL and three.js
WebGL and three.js
 
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesCUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
 
3Dtexture_doc_rep
3Dtexture_doc_rep3Dtexture_doc_rep
3Dtexture_doc_rep
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184
 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to R
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
 
Foundations of Programming - Java OOP
Foundations of Programming - Java OOPFoundations of Programming - Java OOP
Foundations of Programming - Java OOP
 
openFrameworks 007 - GL
openFrameworks 007 - GL openFrameworks 007 - GL
openFrameworks 007 - GL
 
Jetpack Compose - Hands-on February 2020
Jetpack Compose - Hands-on February 2020Jetpack Compose - Hands-on February 2020
Jetpack Compose - Hands-on February 2020
 
java graphics
java graphicsjava graphics
java graphics
 

Recently uploaded

9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girlsPooja Nehwal
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)Delhi Call girls
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...PsychicRuben LoveSpells
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)Delhi Call girls
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushShivain97
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)Delhi Call girls
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxpadhand000
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)Delhi Call girls
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morvikas rana
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,dollysharma2066
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfpastor83
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theorydrae5
 

Recently uploaded (15)

9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptx
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 

Bucc Toy Project: Learn programming through Game Development

  • 1. BUCC Toy Project: Angry Jolly Birds in 3D (3D game) Day II 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/Angry JollyBirds3D
  • 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. Re-cap # We are familiar with methods # We know little bit about inheritance # We know how to instantiate # We have created a box using our JME3
  • 5. Re-cap 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 } }
  • 6. Why are we so interested about boxes? Simple answer! Not only because it is so simple to create but also because our Angry and Jolly Birds will love to hit them more often.
  • 7. Why are we so interested about boxes? How many boxes are there? Ahh.. Don’t waste your valuable time counting boxes… Not less than 86 boxes there is.
  • 8. But our boxes are not cool! So lets make it cool first! How can we make them look cool? Changing material color to yellow? mat.setColor("Color", ColorRGBA.Yellow); But it is not enough cool for us, or is it? NO, IT SIMPLY DOES NOT!
  • 9. Assets So as you can see there is a “Project Assets” in each JME3 project by default. To make our box beautiful we will add textures and as you can see there is a Texture folder in the assets directory. We will keep all the beautiful things in this directory.
  • 11. Setting today's goal Mumit Sir always taught us to keep our goal and our current state together side by side so that we never get misleaded. In fact: “You can’t reach your goal unless you have one”
  • 12. Setting today's goal So what’s our goal? And where are we?
  • 13. Texture Lets draw an image file similar to their box, box.jpeg and put in the Texture directory.
  • 14. Texture There is no magic I said earlier, so it won’t appear like this, we need to modify our code to make it happen. We need to get the assets and then add it with the materials. So 2 steps: i)Getting texture asset ii)Adding texture to the material
  • 15. Texture i)Get the asset: Texture t = assetManager.loadTexture("Textures/BrickWa ll.jpg"); ii) Adding it: mat.setTexture("ColorMap",t);
  • 16. Texture 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; import com.jme3.texture.Texture; 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 Texture t = assetManager.loadTexture("Textures/box.jpg"); mat.setTexture("ColorMap",t); //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 } }
  • 17.
  • 18. Size Now resize our box to make it even better! We are using this code to create a box: Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin Vector3f.ZERO is the location of its origin And rest of the 1,1,1 are its size in x,y,z coordinate. Lets resize it 3ce in y coordinate.
  • 19. Size 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; import com.jme3.texture.Texture; 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, 3, 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 Texture t = assetManager.loadTexture("Textures/box.jpg"); mat.setTexture("ColorMap",t); //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 } }
  • 20. Size Lets copy our code and give them different variable names as otherwise it won’t work since we already know how to change size lets apply our knowledge. Make its width 3 times bigger in width rather than in height. Box b = new Box(Vector3f.ZERO, 3, 1, 1); // create cube shape at the origin
  • 21. Size package mygame; import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.texture.Texture; public class HelloJME3 extends SimpleApplication { public static void main(String[] args) { HelloJME3 app = new HelloJME3(); app.start(); } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 3, 1); Geometry geom = new Geometry("Box", b); Box b2 = new Box(Vector3f.ZERO, 3, 1, 1); Geometry geom2 = new Geometry("Box", b2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Texture t = assetManager.loadTexture("Textures/box.jpg"); mat.setTexture("ColorMap",t); //mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); geom2.setMaterial(mat); rootNode.attachChild(geom2); rootNode.attachChild(geom); } }
  • 22. Location It produces a cross because We forgot to change the origin Vector3f.ZERO
  • 23. Location Vector3f.ZERO are nothing but the short hand of writing (0,0,0) as a origin. If we would have written instead of Vector3f.ZERO then the origin would not have been the same: new Vector3f(x,y,z) Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1);
  • 24. Location package mygame; import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.texture.Texture; public class HelloJME3 extends SimpleApplication { public static void main(String[] args) { HelloJME3 app = new HelloJME3(); app.start(); } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 3, 1); Geometry geom = new Geometry("Box", b); Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1); Geometry geom2 = new Geometry("Box", b2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Texture t = assetManager.loadTexture("Textures/box.jpg"); mat.setTexture("ColorMap",t); //mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); geom2.setMaterial(mat); rootNode.attachChild(geom2); rootNode.attachChild(geom); } }
  • 25. Location package mygame; import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.texture.Texture; public class HelloJME3 extends SimpleApplication { public static void main(String[] args) { HelloJME3 app = new HelloJME3(); app.start(); } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 3, 1); Geometry geom = new Geometry("Box", b); Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1); Geometry geom2 = new Geometry("Box", b2); Box b3 = new Box(new Vector3f(8,0,0), 1, 3, 1); Geometry geom3 = new Geometry("Box", b3); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Texture t = assetManager.loadTexture("Textures/box.jpg"); mat.setTexture("ColorMap",t); //mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); geom2.setMaterial(mat); geom3.setMaterial(mat); rootNode.attachChild(geom3); rootNode.attachChild(geom2);
  • 26. It is said that: “if you can’t make it, Fake it.” At this moment we can’t create beautiful pigs in the screen, we will create 3D object next time but lets fill it with something. Maybe a sphere?
  • 27. Adding Sphere package mygame; import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box; import com.jme3.texture.Texture; public class HelloJME3 extends SimpleApplication { public static void main(String[] args) { HelloJME3 app = new HelloJME3(); app.start(); } public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 3, 1); Geometry geom = new Geometry("Box", b); Box b2 = new Box(new Vector3f(4,4,0), 4, 1, 1); Geometry geom2 = new Geometry("Box", b2); Box b3 = new Box(new Vector3f(8,0,0), 1, 3, 1); Geometry geom3 = new Geometry("Box", b3); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Texture t = assetManager.loadTexture("Textures/box.jpg"); mat.setTexture("ColorMap",t); //mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); geom2.setMaterial(mat); geom3.setMaterial(mat); Material pig_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); pig_mat.setColor("Color", ColorRGBA.Green); pig_geo.setMaterial(pig_mat); rootNode.attachChild(pig_geo); pig_geo.setLocalTranslation(new Vector3f(2,6,0)); rootNode.attachChild(geom3); rootNode.attachChild(geom2); rootNode.attachChild(geom); } }
  • 28. Compare “A goal properly set is halfway reached.” -Zig Ziglar