Well, I want to make an on screen controller, kind of like a joystick, but one that doesn't return to the center and that doesn't stay pressed. Basically a half circle, the top radius would be for full speed forward, and the position would be for turning left or right(not turn would be in the center). One that can be touched anywhere and not moved from the center to a point.

I know I could make a lot(like 500) if statements for each little square area within the half circle controller area, and then set the movements based on that. I could also just use pi to calculate exactly where and how far from the radius the player is touching. Which ever is chosen, it'll be constantly looped if the area of the controller is touched.

You could just calculate the rotation between the center point and the point that is pressed on the controller and also the distance. The distance would be the power the stick is bent, and the rotation would be by how much the stick is rotated.

In this drawing, black circle is the rotation stick pad. Red dot inside of black dot is the center of the pad. Green line going up is the line from which rotation is calculated. Red dot is a point where user is tapping. Purple thingy is the rotation from the green line to the tap point. Yellow line is the distance from center to tap point.

Both options are computationally inconsequential, when performed at the (relatively low) frequency you are talking about.Don't worry about it, and go with the sane route. It's also the one that isn't a horrible approximation.

EDIT: also, to attempt to clear up any misconception, "pi is expensive" argument is non-existent as PI is stored as a constant value as Math.PI. It's not calculated every time you use it, in fact it's never calculated, it's hardcoded in the source of Math.java

Alright, got it up and running on my phone and I can't see a performance slow down at all. I don't know if I really like the joystick idea. I'm using a half circle rather than a full one and it seems weird on a cell phone. It's faster than the push buttons I had, but it's a bit awkward.

This is about the little mobile 3D game you are working on, correct?Why don't you try to use a "go to" based movement system instead of a "go into key direction" one? It would be a lot more user friendly and only a little bit work for you.

Here's a video showing the controller I put into it. I think it may work a bit better if I set the input area up to go a little bit beyond the picture of the controller. The biggest problem I have with it is the sudden stopping when I touch just out of the controller area.

Everything has been really easy so far, as far as the programming goes. It seems like the general layout of the screen has been the most difficult.

Cas and Cero are right though. Although I can tolerate games like JRPGs that emulate SNES controllers (e.g. games that aren't twitch based), it's just impossible to play action games with an emulated analog stick and buttons. The responsiveness is horrible, you accidentally miss the buttons all the time, etc. I end up fighting the controls more than the actual enemies in the game, and it's just so frustrating I've simply given up on action games on phones.

Play to the controller's strengths: you've got fairly accurate instant positional ability (tap-to-walk), intuitive drag to scroll or rotate (two fingers) or just keep the player avatar central. That sort of thing.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org