Skip to main content

Posts

Showing posts with the label 2d game
 

How to make a 2D Game in Android Studio Using Koltin 004

Hi Guys, This is our four article on " How to make a 2D Game in Android Studio Using Koltin ", also this is our last article on the 2d game in the android studio. In this article, we will draw obstacles on the surface of the screen, And we will draw the game over and scoreboard on the screen. If you did not read the previous article, then Click Here . Let move to the tutorial. Create A New Kotlin Class Create a new Kotlin class, Name it "ObstacleManager". Basically, we will handle the color, height, gap of the obstacles and also we will handle the player gap in the obstacles manager, and we will show the game over when the player hits the obstacles, also we will add score when player pass through the obstacles. We will mention an array list of obstacles to the obstacles manager. We will add the color handler in the obstacles manager. So, copy the below codes and it into your "ObstacleManager". 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1...

How to make a 2D Game in Android Studio Using Koltin 003

How to make a 2D Game in Android Studio Using Koltin 003  Hi Guys, So, we have completed the "Game Loop" and we have successfully created a rectangle in our screen. Now in this article, we will describe our obstacles size, width, height, and the gap from where our player can pass. And In the next article, we will draw obstacles on the screen. If you have not read, previous articles yet, then click here . So, Let's get started with our tutorial. Create an Object Create an object and Name it "Constants" In the constants object, we will store the screen height, screen width, and the context, init time of the game. Copy below codes and paste it into your constants object. 1 2 3 4 5 6 7 object Constants { var SCREEN_WIDTH:Int = 0 var SCREEN_HEIGHT:Int = 0 var CURRENT_CONTEXT: Context? = null var INIT_TIME:Long = 0 } Now, describe the screen width and screen height in the main activity. Just copy the b...

How to make a 2D Game in Android Studio Using Koltin 002

Hi Guys, In the previous article, we have learned how to develop the game loop in the android studio using Kotlin. So, In this article, we will learn how to draw characters on the surface. If you have not read the previous article yet, click here to read the previous article tutorial of " How to make a 2D Game in Android Studio Using Koltin 002 ". So, let get started with our tutorial. Create an Interface Now, create an Interface in the project. Left Click on the "com.example.user.game". Then, select "new" and after that, click on "Kotlin File/Class".  After that, Name it "GameObject" and In the kind section, select Interface and Click Ok. We are using interface in the project because when we add methods in the interface and implement the interface in the class, we want to add the same method in the class as an override method. In the next paragraph, I will explain it in more detail. Add two func...

How to make a 2D Game in Android Studio Using Koltin

2D Game in Android Studio Using Koltin Hello guys, There are many games in the Play Store, which are developed by the much big company. If you want to develop, that type of games, then you surely move to Unity, which is a platform to developed 3D games. But if don't want to develop 3D games, then you can try android studio to develop 2D games. I completely agree that android studio is not for game development, but if you started with game development in the android studio, it will be very easy to develop an application in the android studio. In this tutorial post, we will learn " How to make a 2D Game in Android Studio Using Koltin ".We will use kotlin language for this tutorial. Our game will look like this after development: So, Let get started with the tutorial: Create a new project in Android Studio Create an empty project in the android studio. Name your application. Then select the Kotlin support. After that, select the API l...