Android [SOLVED] OUYA Left Analog Stick

S

Sam (Deleted User)

Guest
I'm trying to port a game of mine to OUYA, and I have a cursor object I'd like to move with the left analog stick.

Here's the step event for my cursor object:
Code:
if (gamepad_is_connected(0)) {
    
        gamepad_set_axis_deadzone(0, 0.05);
        var haxis = gamepad_axis_value(0, gp_axislh);
        var vaxis = gamepad_axis_value(0, gp_axislv);
        direction = point_direction(0, 0, haxis, vaxis);
        speed = point_distance(0 ,0, haxis, vaxis) * 5;

}
From the docs (link):
Android export supports NYKO controllers and generic Bluetooth controllers (including the OUYA), but only when they are enabled, meaning that you will have to tick the iCade/Bluetooth option in the Android Tab of the Global Game Settings. They require API level 12 for them to work fully and it should be noted that GameMaker: Studio will register as connected any Bluetooth devices that your device is paired with, whether or not it’s actually connected. Therefore this should be taken into account when assigning and checking "slots".
I have API level 12 installed, and I have the GGS checkbox for iCade/Bluetooth checked under Android settings.

But I tried using the left analog stick to move the cursor object, and nothing happens.

What am I doing wrong?

Thanks!
Samuel
 
J

Jaqueta

Guest
I think... Nothing?
1 - You can try to set the position directly with the value of the gamepad:
Code:
x+=gamepad_axis_value(gdevice, gp_axislh)*cursor_speed;
y+=gamepad_axis_value(gdevice, gp_axislv)*cursor_speed;
2 - Make sure that the connected gamepad is device 0. You can use "gamepad_is_connected" function within a for loop, to check which gamepad is being used.
Code:
///draw_gamepad_list(x,y)
var str="";
for (i=0; i<4; i+=1)
{
    str+="Gamepad "+string(i)+" is connected: "+string(gamepad_is_connected(i))+"#";
};
draw_text(argument0,argument1,str);
3 - Check if you're not setting the speed of the cursor anywhere else. If your object have a Friction bigger or equal 1, the object won't move.

4 - Try rewriting the code from scratch, in a blank project, to make sure that the problem is with GM itself, if you're 100% sure that the problem is with GM, file a bug report.
 
S

Sam (Deleted User)

Guest
Thank you so much for your quick response. :)

1) that shouldn't make any difference as I tried what you suggested in point 4).
2) I have only one gamepad paired with my ouya so only gamepad 0 should be detected
3) I am not setting the cursor speed anywhere else
4) I tried this, and still no cursor movement.

Is there anything wrong with how I have GGS set up, and do I have everything I need in my Android SDK? (see screenshots)
I don't have the obsolete stuff installed in the Android SDK, do I need those?

@Mike @rwkay do you guys happen to know what I'm doing wrong?
 

Attachments

Last edited by a moderator:
S

Sam (Deleted User)

Guest
index 0 is usually reserved and so the first gamepad would go into index 1.
You can see how many devices are connected using gamepad_get_device_count();
And you can get their descriptions using gamepad_get_description(pad index);
Have you read this tech blog?
I'm trying it with an index of 1 now and will get back to you guys with my results.

And if that doesn't work, I'll check out that tech blog. Thanks @BarrowBloke :D

OMG so setting the index to 1 got it working! Thank you @BarrowBloke ! :D :D
 
Top