Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Android Game Development
  • Table Of Contents Toc
Learning Android Game Development

Learning Android Game Development

By : Malankar
2 (2)
close
close
Learning Android Game Development

Learning Android Game Development

2 (2)
By: Malankar

Overview of this book

In this book, we’ll start with installing Android studio and its components, and setting it up ready for Android N. We teach you how to take inputs from users, create images and interact with them, and work with sprites to create animations. You’ll then explore the various collision detection methods and use sprites to create an explosion. Moving on, you’ll go through the process of UI creation and see how to create buttons as well as display the score and other parameters on screen. By the end of the book, you will have a working example and an understanding of a 2D platform game like Super Mario and know how to convert your 2D games to 3D games.
Table of Contents (11 chapters)
close
close
4
Creating Sprites and Interactive Objects

Creating a pyramid 3D object


Now that you have understood how to define shapes and render objects on screen, it will be comparatively easier to create our 3D object. We will follow almost the same procedure as we did to create our triangle. We will create our pyramid right besides our triangle; let's begin.

Defining the shape

As we've learned from the previous part, we will first create a class of our pyramid in order to define our shape. So create a file Pyramid.java to define the shape of our pyramid object.

Our pyramid has five faces, so we will require five vertices to draw our pyramid. So after you create your Pyramid.java, we will define our vertices, as follows:

//Package name of our game

public class Pyramid {
    private float[] vp = { // 5 vertices of the pyramid in (x,y,z)
            -1.0f, -1.0f, -1.0f,  //left-bottom-back
            1.0f, -1.0f, -1.0f,  //right-bottom-back
            1.0f, -1.0f,  1.0f,  //right-bottom-front
            -1.0f, -1.0f,  1.0f,  //left-bottom-front...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Android Game Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon