Jump to content
  • Advertisement

GameDeveloper93

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

113 Neutral

About GameDeveloper93

  • Rank
    Newbie
  1. GameDeveloper93

    Java how to do this

    If you look at the below code  for(int i =0; i<enLang.length; i++) { strOutput = english.getText().toString().replaceAll(enLang[i], petLang[i]); } id like to take all values from the array enLang in order and replace them with the values from petLang   in PHP i would just do this  preg_replace($words['enLang'],$words['petLang'],$str); whats the equivalent of the above PHP?
  2. GameDeveloper93

    OnTouch event android development issue

    Yes the x and y seems to be correct do u have anymore ideas what may be causing this?
  3. GameDeveloper93

    OnTouch event android development issue

    For got to mention i have tried both getX() and getY() and also getRawX() and getRawY() both have gave me the same result unfortunately 
  4. I'm building a touch game where you have to touch the inside of an image that was drawn on a canvas. The image gets drawn at new positions every few secs anyways the issue is detecting a touch inside the image. The below is my touch event and it does work however it only detects the touch if you touch the top of the image but anywhere else it fails to synchronized public boolean onTouchEvent(MotionEvent event){ boolean handled = false; int action = event.getAction(); int x = (int) event.getRawX(); //or event.getRawX(); int y = (int) event.getRawY(); switch (action){ case MotionEvent.ACTION_DOWN: touchDownTime = SystemClock.elapsedRealtime(); break; case MotionEvent.ACTION_UP: if ( x >= bonX && x < bonX + ((GameWorld)findViewById(R.id.game_canvas)).joviWidth() && y >= bonY && y < bonY + ((GameWorld)findViewById(R.id.game_canvas)).joviHeight() ) { Log.d("TOuched",x+","+y); } handled = true; break; } return handled; } how you guys will be able to provide some help thank you   Edit: Just notice I may of posted this in the wrong area i'm sorry if i did
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!