Den onsdagen den 12:e september 2012 kl. 00:09:46 UTC+2 skrev iQue:
>
> I'm using joysticks to controls my game-characters movement and the
> direction he fires, and to keep these joysticks within its bound I use this
> code:
>
> if (touchingPoint.x < (int) (steeringxMesh - 25)) {
> touchingPoint.x = (int) (steeringxMesh - 25);
> }
> if (touchingPoint.x > (int) (steeringxMesh + 25)) {
> touchingPoint.x = (int) (steeringxMesh + 25);
> }
> if (touchingPoint.y < (int) (yMesh - 25)) {
> touchingPoint.y = (int) (yMesh - 25);
> }
> if (touchingPoint.y > (int) (yMesh + 25)) {
> touchingPoint.y = (int) (yMesh + 25);
> }
>
> this code makes my streering a big pain in the ass, since it basicly makes
> my joystick move within a square.
>
> I want to change this so it checks if Ive pressed within a circle the size
> of my joysticks background-image.
>
> Say the joysticks background image is 50x50, how do I make a circle in
> android with this size in mind, and how do i check if im pressing within it.
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en