Facebook Twitter Instagram
    DeepCrazyWorld
    Facebook Twitter Instagram Pinterest YouTube
    • FLUTTER
      • FLUTTER APP
        • QRCode
        • Quiz App
        • Chat GPT
        • PDF App
        • News App
        • Fitness App
        • Weather App
        • BMI Calculator
        • GAME APP
        • Ecommerce App
        • wallpaper App
        • Finance app
        • Chat App
        • Wallet App
        • Taxi App
        • Quran app
        • Music player app
      • FLUTTER UI
        • Splash Screen
        • Onboarding Screen
        • Login Screen
        • Card Design
        • Drawer
    • PROJECT
      • Android Projects
      • College Projects
      • FLUTTER APP
      • Project Ideas
      • PHP Projects
      • Python Projects
    • SOURCE CODE
    • ANDROID
      • ANDROID APP
      • GAME APP
      • ANDROID STUDIO
    • MCQ
      • AKTU MCQ
        • RPA MCQ
        • COA MCQ
        • HPC MCQ
        • SPM MCQ
        • Renewable Energy All MCQ
        • Data Compression MCQ
        • Data Structure MCQ
        • Digital Image Processing MCQ
        • Software Engineering MCQ
        • Machine Learning MCQ
        • Artificial Intelligence MCQ
      • D PHARMA MCQ
        • Pharmaceutics – I MCQ
        • Pharmacognosy MCQ
        • Pharmaceutical Chemistry MCQ
        • Biochemistry and Clinical Pathology MCQ
        • Human Anatomy and Physiology MCQ
        • Heath Education and Community Pharmacy MCQ
    • INTERVIEW QUESTIONS
      • Flutter Interview Questions
      • INTERVIEW QUESTIONS
      • Python Interview Questions
      • Coding ninjas solution
    • MORE
      • WORDPRESS
        • SEO
        • TOP 10 WORDPRESS THEME
      • PRODUCTIVITY
      • Program
      • QUOTES
    DeepCrazyWorld
    Home»Android App Development»Android Game Development tutorial for biggners | source code free
    Android App Development

    Android Game Development tutorial for biggners | source code free

    DeepikaBy DeepikaNovember 4, 2019Updated:January 19, 2022No Comments7 Mins Read

    Table of Contents

    Toggle
      • Android Game Development tutorial
    • About Flying fish game
    • MainActivity.java
    • FlyingFishView.java
    • SplashActivity.java
    • GameOverActivity.java
      • this is android game development XML file source code
    • activity_main.xml
    • activity_splash.xml
    • activity_game_over.xml
      • Manifest File Source Code
    • AndroidManifest.xml
    • res > values > colors.xml
    • Visit my Google Play Store Apps
    • Flying Fish YouTube Video
    • Get The Flying Fish Full Source Code
        • Click below to get the full source code android application.
    • Conclusion
      • Cheers!
    • READ MORE…

    Android Game Development tutorial

    In this android game Development tutorial we are going to create a amazing 2D Flying fish game app with source code free and provide a YouTube video .The Flying Fish Game is Simple and very Sweet Game to play For kids and Everyone

    About Flying fish game

    1.Flying Fish is back with new ways to play game.
    Its an amazing game which will help u to increase your concentration and
    In this game you will able to see the 3 balls but in which the blue and green ball is helpful for getting score and black ball is negative.


    The original mode is back with improved physics and other refinements.In this android game Development tutorial Jump through three rings in a row to get a shot at a bonus ring for extra points.
    Again Triple Ring Mode – The title says it all, there are three times the amount of rings and three times the amount of points!

    <img decoding=

    There are also new and returning skins, all completely redrawn to look better than ever. so try to unlock the new themes! and These change your background to better fit your preference , Because this android flying fish game is very interesting. so let’s play our game and how to make flying fish app.

    MainActivity.java

    package com.deep.flyingfishh;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.os.Bundle;
    import android.os.Handler;
    
    
    import java.util.Timer;
    import java.util.TimerTask;
    
    public class MainActivity extends AppCompatActivity {
        private  FlyingFishView gameView;
        private Handler handler = new Handler();
        private final  static  long Interval = 30;
    
    
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
    
    
            gameView = new FlyingFishView(this);
            setContentView(gameView);
    
            Timer timer = new Timer();
            timer.schedule(new TimerTask() {
                @Override
                public void run() {
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            gameView.invalidate();
                        }
                    });
                }
            }, 0, Interval);
        }
    }
    

    Android game development This is Flying Fish View Source Code

    FlyingFishView.java

    package com.deep.flyingfishh;
    
    import android.content.Context;
    import android.content.Intent;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Canvas;
    import android.graphics.Color;
    import android.graphics.Paint;
    import android.graphics.Typeface;
    import android.view.MotionEvent;
    import android.view.View;
    import android.widget.Toast;
    
    public class FlyingFishView extends View
    {
        private Bitmap fish[] = new Bitmap[2];
        private int fishX = 10;
        private  int fishY;
        private  int fishSpeed;
        private  int canvasWidth, canvasHeight;
    
        private  int yellowX, yellowY, yellowSpeed = 16;
        private Paint yellowPaint = new Paint();
    
        private  int greenX, greenY, greenSpeed = 20;
        private Paint greenPaint = new Paint();
    
        private  int redX, redY, redSpeed = 25;
        private Paint redPaint = new Paint();
    
    
        private  int score, lifeCounterOfFish;
    
    
        private boolean touch = false;
    
        private Bitmap backgroundImage;
        private Paint scorePaint = new Paint();
        private Bitmap life[] = new Bitmap[2];
    
    
        public FlyingFishView(Context context) {
            super(context);
    
            fish[0] = BitmapFactory.decodeResource(getResources(), R.drawable.fish1);
            fish[1] = BitmapFactory.decodeResource(getResources(), R.drawable.fish2);
    
            backgroundImage = BitmapFactory.decodeResource(getResources(), R.drawable.background);
    
            yellowPaint.setColor(Color.YELLOW);
            yellowPaint.setAntiAlias(false);
    
            greenPaint.setColor(Color.GREEN);
            greenPaint.setAntiAlias(false);
    
            redPaint.setColor(Color.RED);
            redPaint.setAntiAlias(false);
    
    
    
            scorePaint.setColor(Color.WHITE);
            scorePaint.setTextSize(70);
            scorePaint.setTypeface(Typeface.DEFAULT_BOLD);
            scorePaint.setAntiAlias(true);
    
            life[0] = BitmapFactory.decodeResource(getResources(), R.drawable.hearts);
            life[1] = BitmapFactory.decodeResource(getResources(), R.drawable.heart_grey);
    
            fishY = 550;
            score = 0;
            lifeCounterOfFish = 3;
        }
    
    
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
    
            canvasWidth = canvas.getWidth();
            canvasHeight = canvas.getHeight();
    
    
            canvas.drawBitmap(backgroundImage, 0, 0, null);
            int minFishY = fish[0].getHeight();
            int maxFishY = canvasHeight - fish[0].getHeight() * 3;
            fishY = fishY + fishSpeed;
    
            if (fishY < minFishY) {
                fishY = minFishY;
            }
    
            if (fishY > maxFishY) {
                fishY = maxFishY;
            }
            fishSpeed = fishSpeed + 2;
    
            if (touch) {
                canvas.drawBitmap(fish[1], fishX, fishY, null);
                touch = false;
            } else {
                canvas.drawBitmap(fish[0], fishX, fishY, null);
    
            }
    
            yellowX = yellowX - yellowSpeed;
            if (hitBallChecker(yellowX, yellowY)) {
                score = score + 10;
                yellowX = -100;
            }
            if (yellowX < 0) {
                yellowX = canvasWidth + 21;
                yellowY = (int) Math.floor(Math.random() * (maxFishY - minFishY)) + minFishY;
            }
            canvas.drawCircle(yellowX, yellowY, 25, yellowPaint);
    
    
            greenX = greenX - greenSpeed;
            if (hitBallChecker(greenX, greenY)) {
                score = score + 20;
                greenX = -100;
            }
            if (greenX < 0) {
                greenX = canvasWidth + 21;
                greenY = (int) Math.floor(Math.random() * (maxFishY - minFishY)) + minFishY;
            }
            canvas.drawCircle(greenX, greenY, 25, greenPaint);
    
    
            redX = redX - redSpeed;
            if (hitBallChecker(redX, redY)) {
    
                redX = -100;
                lifeCounterOfFish--;
    
                if (lifeCounterOfFish == 0) {
                    Toast.makeText(getContext(), "Game Over", Toast.LENGTH_SHORT).show();
    
                    Intent gameOverIntent = new Intent(getContext(), GameOverActivity.class);
                    gameOverIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    gameOverIntent.putExtra("score", score);
                    getContext().startActivity(gameOverIntent);
    
                }
            }
            if (redX < 0) {
                redX = canvasWidth + 21;
                redY = (int) Math.floor(Math.random() * (maxFishY - minFishY)) + minFishY;
            }
            canvas.drawCircle(redX, redY, 30, redPaint);
    
    
            canvas.drawText("Score : " + score, 20, 60, scorePaint);
            for (int i = 0; i < 3; i++) {
                int x = (int) (580 + life[0].getWidth() * 1.5 * i);
                int y = 30;
    
                if (i < lifeCounterOfFish) {
                    canvas.drawBitmap(life[0], x, y, null);
                } else {
                    canvas.drawBitmap(life[1], x, y, null);
                }
            }
    
    
        }
    
        public boolean hitBallChecker(int x, int y)
        {
            if (fishX < x && x < (fishX + fish[0].getWidth()) && fishY < y && y < (fishY + fish[0].getHeight()))
            {
                return  true;
            }
            return  false;
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event)
        {
          if (event.getAction() == MotionEvent.ACTION_DOWN)
          {
              touch = true;
              fishSpeed = -22;
          }
          return true;
        }
    }
    

    SplashActivity.java

    package com.deep.flyingfishh;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.Intent;
    import android.os.Bundle;
    
    public class SplashActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splash);
    
            Thread thread = new Thread()
            {
                @Override
                public void run()
                {
                    try
                    {
                     sleep(5000);
                    }
                    catch (Exception e)
                    {
                       e.printStackTrace();
                    }
                    finally
                    {
                        Intent mainIntent = new Intent(SplashActivity.this, MainActivity.class);
                        startActivity(mainIntent);
                    }
                }
            };
            thread.start();
    
    
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            finish();
        }
    }
    
    <img loading=

    This is Source Code of Game Over Activity Code

    GameOverActivity.java

    package com.deep.flyingfishh;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;
    
    public class GameOverActivity extends AppCompatActivity {
        private Button StartGameAgain;
    
        private TextView DisplayScore;
        private String score;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_game_over);
    
            score = getIntent().getExtras().get("score").toString();
    
            StartGameAgain = (Button) findViewById(R.id.play_again_btn);
            DisplayScore = (TextView) findViewById(R.id.displayScore);
    
    
            StartGameAgain.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
    
                    Intent mainIntent = new Intent(GameOverActivity.this, MainActivity.class);
                    startActivity(mainIntent);
                }
            });
            DisplayScore.setText("Score= " + score);
        }
    }
    

    ————————————————————————————————————————–

    this is android game development XML file source code

    activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
    
    
    </RelativeLayout>

    activity_splash.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/splash1"
        tools:context=".SplashActivity">
    
        <ImageView
            android:id="@+id/imageView"
            android:layout_width="300dp"
            android:layout_height="300dp"
            android:layout_below="@+id/textview1"
            android:layout_centerHorizontal="true"
            android:src="@drawable/splash_icon"/>
    
        <TextView
            android:id="@+id/textview1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Flying Fish"
            android:textAlignment="center"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="130dp"
            android:textColor="@color/colorAccent"
            android:textStyle="bold"
            android:textSize="34sp"/>
    
    
    
    
    </RelativeLayout>

    activity_game_over.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/splash1"
        tools:context=".GameOverActivity">
    
    
        <TextView
            android:id="@+id/gameOver"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="80dp"
            android:text="Game Over"
            android:textAlignment="center"
            android:textColor="@color/colorAccent"
            android:textSize="70dp"
            android:textStyle="bold" />
    
        <Button
            android:id="@+id/play_again_btn"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/gameOver"
            android:layout_centerHorizontal="true"
            android:background="@color/colorAccent"
            android:padding="10dp"
            android:text="Play Again"
            android:textAllCaps="false"
            android:textColor="@android:color/background_light"
            android:textSize="18sp"
            android:textStyle="bold" />
    
        <TextView
            android:id="@+id/displayScore"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="450dp"
            android:text="score"
            android:textAlignment="center"
            android:textAppearance="@style/TextAppearance.AppCompat.Small"
            android:textColor="#F44336"
            android:textSize="36sp"
            android:textStyle="bold" />
    
    
    </RelativeLayout>

    ——————————————————————————————————————

    Manifest File Source Code

    AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.deep.flyingfishh">
    
    
    
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
    
    
    
            <activity android:name=".GameOverActivity"></activity>
            <activity android:name=".MainActivity"></activity>
            <activity android:name=".SplashActivity">
    
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    <img loading=
    Game Over Flying Fish Game

    res > values > colors.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="colorPrimary">#008577</color>
        <color name="colorPrimaryDark">#00574B</color>
        <color name="colorAccent">#D81B60</color>
    </resources>
    


    Visit my Google Play Store Apps

    Visit For Browser 5 G App On google Play Store>>>>>>>>>>

    This My Creative App Click on DeepCrazyWorld App>>>>>>>>>>>

    To Solve Your Math Calculation Math Solve App >>>>>

    Spinner Bottle Game App>>>>>>>>>>>>>>>>>>>>>

    This News Nation App News7on>>>>>>>>>>>>>>

    Shopping App ZampKart >>>>>>>>>>>>>>>>>>>

    Math Equation Solving App>>>>>>>>>>>>>>>>>>>

    Event Basis Picture LovingCaring143 App>>>>>>>>>

    Here This Blogger Site App to Explore Your Knowledge Download all this Apps By Google Play Store My Blogger Site App Download And InstallParagraph

    Click on Link CrazyCoder>>>>>>>>>>

    Flying Fish YouTube Video

    Get The Flying Fish Full Source Code

    Click below to get the full source code android application.

    Flying Fish game Images Download Click Here.

    GO TO DOWNLOAD PAGE

    Conclusion

    We have successfully created a android game development- Flying Fish game Android application using Android Studio.


    Cheers!

    READ MORE…

    Share. Facebook Twitter LinkedIn WhatsApp Telegram Pinterest Reddit Email
    Previous ArticleHow to make Calculator app in android studio source code
    Next Article Create Spinner Bottle game App with Source code using android studio

    Related Posts

    Google play console All basic details Step by step 2023

    Android App Development 9 Mins Read

    How to Update Rejected app from Google play console 2023

    Android App Development 4 Mins Read

    Tetris Block Puzzle Game Android App with android studio 2023

    ANDROID APP 3 Mins Read

    Maze Goal Best Entertaining Game app with android studio

    ANDROID APP 2 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Implementing a Dynamic FAQ Screen UI in Flutter Using ExpansionTile March 29, 2025
    • Creating an Instruction UI Screen in Flutter Application March 29, 2025
    • Animated Backgrounds in Flutter: A Complete Guide March 15, 2025
    • How to make Diary App using flutter stepwise using getx August 31, 2024
    • How to Create Music Player UI screen with fully functional in flutter August 30, 2024
    • How to make ListView Builder Ui in flutter with Source Code August 29, 2024
    • Create a TabBar View in flutter with fully functional stepwise August 28, 2024
    • How to create TabBar view in flutter with source code step wise August 27, 2024
    • How to make Heart rate measure app with Flutter stepwise August 26, 2024
    • How to make ChatGpt App in flutter with source code Stepwise August 25, 2024
    Facebook Twitter Instagram Pinterest YouTube
    • About
    • Contact
    • Disclaimer
    • Privacy Policy
    Copyright by DeepCrazyWorld © 2025

    Type above and press Enter to search. Press Esc to cancel.