Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:03:22+00:00 2026-06-03T23:03:22+00:00

Hi im making a split screen game and i cannot figure out how to

  • 0

Hi im making a split screen game and i cannot figure out how to get the controls down. Right now they work fine if only one person is touching the screen but once multiple do the first person to touch is the only one who can control. So i need to implement multitouch. I cant figure out how to do it so once one finger is down controlling the object on the top half of the screen another finger can be put down controlling the bottom half of the screen. How should i do this?

EDIT:
I changed it, it still doesnt work though could somebody tell me why

My attempt that doesnt work:

  public boolean onTouch(View v, MotionEvent event){
      //needs multitouch
      if(checkInGame()){

                if(event.getY() < this.getMeasuredHeight() / 2){  
                    pointerId1 = event.getPointerId(event.getActionIndex());
                }else{
                    pointerId2 = event.getPointerId(event.getActionIndex());    
                }

                switch(event.getAction() & MotionEvent.ACTION_MASK){

                    case MotionEvent.ACTION_MOVE:{

                        if(event.getPointerId(event.getActionIndex()) == pointerId1){  
                            Log.d("Touch","Move1");
                              int pointerIndex = event.getActionIndex();
                          int moveX = 0;
                          int moveY = 0;
                          moveX = (int) event.getX(pointerIndex) - sX;
                          moveY = (int) event.getY(pointerIndex) - sY;

                          ship1.setLoc(moveX, moveY);
                          sX = sX + moveX;
                          sY = sY + moveY;
                        }else if(event.getPointerId(event.getActionIndex()) == pointerId2){
                              int pointerIndex = event.getActionIndex();
                            Log.d("Touch","Move2");
                              int moveX = 0;
                              int moveY = 0;
                              moveX = (int) event.getX(pointerIndex) - sX2;
                              moveY = (int) event.getY(pointerIndex) - sY2;

                              ship2.setLoc(moveX, moveY);
                              sX2 = sX2 + moveX;
                              sY2 = sY2 + moveY;
                        }
                          return true;


                    }
                      case MotionEvent.ACTION_DOWN: {

                            if(event.getPointerId(event.getActionIndex()) == pointerId1){
                                Log.d("Touch","Top1");
                                int pointerIndex = event.getActionIndex();
                                sX = (int) event.getX(pointerIndex);
                                sY = (int) event.getY(pointerIndex);
                            }else if(event.getPointerId(event.getActionIndex()) == pointerId2){
                                int pointerIndex = event.getActionIndex();
                                Log.d("Touch","Bottom1");
                                 sX2 = (int) event.getX(pointerIndex);
                                 sY2 = (int) event.getY(pointerIndex);
                            }
                            return true;
                        }

                      case MotionEvent.ACTION_POINTER_DOWN:{
                            if(event.getPointerId(event.getActionIndex()) == pointerId1){
                                Log.d("Touch","Top2");
                                int pointerIndex = event.getActionIndex();
                                sX = (int) event.getX(pointerIndex);
                                sY = (int) event.getY(pointerIndex);
                            }else if(event.getPointerId(event.getActionIndex()) == pointerId2){
                                int pointerIndex = event.getActionIndex();
                                Log.d("Touch","Bottom2");
                                 sX2 = (int) event.getX(pointerIndex);
                                 sY2 = (int) event.getY(pointerIndex);
                            }
                            return true;
                      }


                }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:03:23+00:00Added an answer on June 3, 2026 at 11:03 pm

    You probably want to track each pointer by its ID. On pointer down, check the ID so you know that pointer with ID 1 is controlling object 1. Give this Android blog post a read, it may help: http://android-developers.blogspot.co.uk/2010/06/making-sense-of-multitouch.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making game plugin in java and Ive got problem with split function. index
im making a mention system like the one in facebook, right now I achieved
I start GVIM in not-maximized window mode and split its window horizontally making sure
Making a drop down list for my JSP and the values I'm entering won't
I'm making a game using JigLib and GLGE . The camera follows the player
I am making a DOM builder which I have working succesfully but now I
I'm making an iPhone game in .lua using IntelliJ IDEA, and I have a
I'm making a splitscreen game. When I render each of the splitscreens, there is
I am making a split function in SQL Server 2005. I have already done
I was making a short little program to split a long integer into smaller

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.