Tag Info

Hot answers tagged

6

You are almost getting it right, but you should use your pointer id to request the X/Y instead of i int id = event.getPointerId(i); int x = (int) event.getX(id); int y = (int) event.getY(id); From the MotionEvent documentation: The order in which individual pointers appear within a motion event is undefined. Thus the pointer index of a ...


6

In a word: Swiping. I played Pac-Man championship edition on my Android phone and what I thought really worked for it is that while there was an on screen joystick, you didn't actually have to touch it to move Pac-Man in the proper direction. If your finger fell off the joystick it didn't matter. All that mattered is in what direction you moved your finger. ...


5

Most any top down perspective will work. 2D games have done this in the past with games like PacMan: Additionally, any top down perspective where the camera is at the center of the screen. This gives the kind of view you showed in your comment: Both of these assume the players are sharing a play field. If the players are not sharing a play field, you ...


3

What if you treated a half of the screen like a virtual track ball where the position/speed of your character is directly tied to that of the ball? Swiping and releasing would set your character into constant motion (and cause the trackball to spin). Holding your finger on the screen would be like holding the trackball so that you could make small ...


3

One good way is to use split screen. Take the 2D image and render it on a side angle (from the player's view). As long as the player is looking at their side there shouldn't be a problem. You can just add a 2D splitter in the middle of the screen.


3

I think this will work for you. One mistake you made was iterating over all pointers for every event. It's only necessary for move events. Secondly, you actually do need to put the index value into the getX and getY functions, but you get the id associated with that index to use as a reference to your game objects. You assign an id to your joystick during ...


3

I don't think that Multi-Touch will ever be big on the PC. One big reason: Just try pushing your monitor. If you are like 99% of all users who have their monitor on a feet or arm, the monitor will now be pushed back. Multitouch works on the iPhone because you hold it in your other hand and provide resistance. But on a PC, finding the right balance between ...


3

To reduce the amount of if statements you have you need to make your solution data-driven instead of manually adding logic for each UI component that needs to interact. You could do this by storing your buttons data (such as each buttons bounding box and state) in an array of structs or a NSArray (or NSMutableArray) of classes. Then when you receive a touch ...


3

Personally, I've found most "on screen joysticks" pretty lame, no matter how slickly they're implemented. Its a pretty clear case of taking a solution from a different technology (consoles/arcades) and trying to apply it to a new and rather different technology (multi-touch screens), and resulting in a mess. So, I'd add some more "cons" to your list that ...


2

Turns out this was a device independent problem (See comments above) and the issue posted to Google Code can be found here. There was actually no problem with the code in libGDX. I'm Posting this as an answer rather than deleting so that people like me can find the answer before ripping their hair out.


2

Given what you've told me in your comment, you can do something like this: float touchX, touchY; public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) { // store values touchX = event.getX(); touchY = ...


2

Well, the answer would probably be: because Windows, Mac and Linux are not primarily touch screen platforms, and multi-touch inputs is a concept that only makes any sense on touch screen platforms. Why would engines support an input mechanism if the platform doesn't? In some cases (e.g. iOS from Mac OS) there's a common framework because the platforms have ...


2

The ACTION_MOVE event provides data for multiple fingers. You can use event.getPointerCount() to find out how many fingers are touching the screen. Then you can loop through the pointers to get data for each one. Example: case MotionEvent.ACTION_MOVE: int count = event.getPointerCount(); for (int i = 0; i < count; i++) { x[i] = ...


2

I found side-of-screen touch and hold controls to be the most responsive. If the person touches the left side, run left (until he lets go). If the person touches the right side, run right. RunRunRiot! is an example of this. As for jumping, you could go for a mid-screen tap (using either hand). Examples (landscaped iPad) Running right ______________ | ...


2

To be honest I've never used the gesture API so my answer might be wrong. However, I think I know how to solve your problem. The idea is to perform action B only if action A has not already occurred and the only way to know this is to somehow detect when the user has released their finger. Since their is no Release gesture type you might be able to craft ...


1

Alright, I figured it out, and it wasn't in the code I displayed. I was checking the CTouch object's previous location against the UITouch object's. What I needed to be doing was checking the CTouch object's current location agains UITouch object's previous. Got it working.


1

Sorry, it seems that I pressed on a area not quick enough to freedrag. It's done well now if there is no delay between "tap" and drag to freedrag


1

I am not sure if I am understanding this correct, but it seems to me like you answered your own question. I touch a large area of my hand onto the screen, then release it Well you touched the screen and release it there are two calls to MotionEvent one with event.ACTION_DOWN and one with event.ACTION_UP then press one of my arrows Again a call ...


1

You can specify the areas by a simple integer (for now). Area A would have index 1, and area B index 2. You will store the last 'tapped' area in a variable. When the finger is released, and the 'released' - where the pointer up event triggered - area is different than the 'tapped' one, you trigger the action. If you want to know when the touch left a ...


1

You could consider having more precise controls for only when the player character is airborne. For instance, if the right side of the screen controlled lateral direction, you could have the entirety of the left side be for the jump. Once airborne, the bottom left half of the screen could be 'descend' and the top half could be double jump. Another option ...


1

The best input for a touch screen game I have found is on those really simple platform games when all you have to do is touch the screen to jump! Any game that uses the accelerometer for movement input to me is very disorienting! This is a common dilemma when developing on a touch screen, if only there was a D-pad attachment that was popular. I think you ...


1

add this code in onCreateEngineOptions() final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera); engineOptions.getTouchOptions().setNeedsMultiTouch(true); if(MultiTouch.isSupported(this)) { ...


1

I can say multi-touch games will be a different genre, not another standard method of input for pc games. There are games people will still prefer to use on controllers. (Imagine street fighter using multi-touch) Multi-touch might only just be useful for entertainment and future homes or even educational game purposes.


1

Ergonomics of multi-touch vertical monitors just doesn't work, not to mention that having your hands in front of the screen isn't ideal for visibility. The idea of multi-touch pads for desktops is interesting, but they have issues. Wacom and similar tablets work well because they can sense the pen when it hovers over the tablet. This allows the user to move ...



Only top voted, non community-wiki answers of a minimum length are eligible