android - if in runnable function not working -
I will show scoring IsCollides is a function that checks the collision.
If you work in other calls then work well but not working in runner function. code> private Rnnebl scoring = new Rnnabl () {@Override public void run () try {// TODO Auto-generated method stub {ifCollides (awards, splash )) {Score ++; P.setText (":" + Score); }} Hold (Exception E) {// TODO Automatic Holding Block e.printStackTrace (); } MHandler.post Delayed (mStartVamp, 3000); }}; Public boolean Colloids (Sprite Sprite 1 Sprite Sprite 2) throws an exception {float diffX = Math.abs ((Sprite1.getX) + Sprite1.getWidth () / 2) - (Sprite2.getX () + Sprite2.getWidth () / 2 )); Float Difarfai = Math.abis ((Spritelkgeti) + Spritelkgetheigt () / 2) - (Sprite2kgeti () + Sprite2kgetheigt () / 2)); If diffX (Sprite1.getWidth) / 2 + Sprite2.getWidth () / 3) & amp; Amp; And diffY & lt; (Sprite1.getHeight () / 2 + Sprite2.getHeight () / 3)) {back true; } Other {return false; }}
Any changes on AndEngine UpdateThread need to AndEngine units - if p.setText () should be run in the call runOnUpdateThread () call - to see how this thread -
Comments
Post a Comment