Loading...
Logo
Processing Forum
ladams14641's Profile
7 Posts
11 Responses
0 Followers

Activity Trend

Last 30 days

Loading Chart...

Show:
Private Message
    processing will spit out an error if my code has an error, but it will not run if i have valid code, the run button shows that its been activated but nothing happens. not sure what to do but its driving me nuts. initially when installing i had android code working, but not normally, it would run it. nothing would happen. but when i unplugged my phone the app was on it, even if it wasnt while running. i have processing on two other PCs but my laptop (vista) doesnt. anyone ever have this issue and found a solution? thank you
    @Override
    public boolean dispatchTouchEvent(MotionEvent event){
      final int action = event.getActionMasked();
     
      switch(action){
      case MotionEvent.ACTION_DOWN:{
       
        float x = event.getX();
        float y = event.getY();
       
        if (x >= 50 && x <= 250 && y >= 521 && y <= 721){
          my_ship.shoot();
          x_angle = atan2(y-620, x-100);
         
        }
        else if(x >= 1050 && x < width-50 && y >= 521 && y <= 721) my_ship.push();  
       
        break;
         //else thrusters = false;
      }
      case MotionEvent.ACTION_MOVE:{
      
        float xm = event.getX();
        float ym = event.getY();
        if (game_started == true && xm >= 50 && xm <= 250 && ym >= 521 && ym <= 721){
          my_ship.shoot();
          x_angle = atan2(ym-620, xm-100);
         
        }else if (xm >= 1050 && xm < width-50 && ym >= 521 && ym <= 721) {
          my_ship.push();
         
        }
        if (game_started == false && xm > width/2-200 && xm < width/2+200 && ym <= height/2+200 && ym >= 200) game_started = true;
         
    }break;
     
      } 
    Seems either one I use I cause my game to freeze. Not all the time, but when i pull finger off the spots that activate particular actions rapidly and constantly it frequently causes the game to crash. I dont remember having a issue when it was single touch, but since ive been trying with multitouch it causes problems. What is the proper way of implementing multi touch does this code look flawed? Is it missing something? if my touches are within the designated spots do i need a else condition for when they are not?

    Oh and is there a way of making it so it registers my touches even if I dont move my fingers? it seems to stop activating once both of my touches stop moving.

    Also I use mouseX and mouseY to clear the initial splash screen. Could that cause confusion? but the issue never arises that early in the game.

    Please and thank you for any help in regards to this.




    void setup(){
    //within setup i have the touches array
    xTouch = new float[10];
    yTouch = new float[10];
    }



    public boolean surfaceTouchEvent(MotionEvent event){
      final int action = event.getAction();
      TouchEvents = event.getPointerCount();
      for (int i = 0; i<TouchEvents; i++){
        int ID = event.getPointerId(i);
      switch(action){
      case MotionEvent.ACTION_DOWN:{
        xTouch[ID] = event.getX(i);
        yTouch[ID] = event.getY(i);
        if (xTouch[ID] >= 50 && xTouch[ID] <= 250 && yTouch[ID] >= 521 && yTouch[ID] <= 721){
          my_ship.shoot();
          x_angle = atan2(yTouch[ID]-620, xTouch[ID]-100);
        }else if (xTouch[ID] >= 1050 && xTouch[ID] < width-50 && yTouch[ID] >= 521 && yTouch[ID] <= 721) my_ship.push();
         //else thrusters = false;
      }
      case MotionEvent.ACTION_MOVE:{
        xTouch[ID] = event.getX(i);
        yTouch[ID] = event.getY(i);
        if (xTouch[ID] >= 50 && xTouch[ID] <= 250 && yTouch[ID] >= 521 && yTouch[ID] <= 721){
          my_ship.shoot();
          x_angle = atan2(yTouch[ID]-620, xTouch[ID]-100);
        }else if (xTouch[ID] >= 1050 && xTouch[ID] < width-50 && yTouch[ID] >= 521 && yTouch[ID] <= 721) my_ship.push();
      }
      }
    }return super.surfaceTouchEvent(event);}


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////OR /////////////////////////////////////////////////


    public boolean surfaceTouchEvent(MotionEvent event){
      TouchEvents = event.getPointerCount();
      for (int i = 0; i<TouchEvents; i++){
        int ID = event.getPointerId(i);
        xTouch[ID] = event.getX(i);
        yTouch[ID] = event.getY(i);
       
       
        if (xTouch[ID] >= 50 && xTouch[ID] <= 250 && yTouch[ID] >= 521 && yTouch[ID] <= 721){
          my_ship.shoot();
          x_angle = atan2(yTouch[ID]-620, xTouch[ID]-100);
         
        }
       
       else if (xTouch[ID] >= 1050 && xTouch[ID] < width-50 && yTouch[ID] >= 521 && yTouch[ID] <= 721) my_ship.push();
         //else thrusters = false;
       
       
      }*/
    I just want to make a copy of the app ive made and send it to a friend, via email, and have him download it on his phone. If I do this do i need to do all that is required to get an app on the play store or can i just export and send email and he just put it on his phone via email?

    thank you in advance
    What am I doing wrong here? the scores.txt file is sitting in the data folder and outside the data folder within the folder this processing file is located. i hit ctrl z and its the same folder. Why wont this work? The text file has only 1 stringed word. error message: The file "scores.txt" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.


    i created the file with the saveStrings() method, so i know its in the correct filetype

    String[] collector = loadStrings("scores.txt");


    void setup(){
      size(400,400);
     
    }

    void draw(){

     println(collector[0]);



    }