Tutorial Request: Android

U

Uhfgood

Guest
I wasn't sure I should post this in the tutorials forum because I'm looking for a tutorial rather than posting one.

Can someone direct me to a decent tutorial on targeting my Android-based phone, preferably the most up-to-date tutorial you can find? Thank you!
 
A

Aura

Guest
What sort of tutorial do you want? Because no single tutorial that I'm aware of teaches you everything about setting up an Android game.
 
U

Uhfgood

Guest
What do you mean "what sort", what 'sorts' are there? There should be at least one that tells you how to target android. I make a basic game (or just anything with interaction) how do I get it to run on my phone?
 
U

Uhfgood

Guest
A) I already do have the android export module, B) I do have the SDK/NDK's downloaded and installed, and C) I just set up the rest of that stuff thanks to that link there Maximus --

Okay at this point I should be able to generate something to run on my phone. Now are there any game tutorials that sort of take you through something basic to put on a touchscreen android device (like my phone)?
 
M

Maximus

Guest
basically everything works as if it was a mouse, with each consecutive press counting as a additional muse device with additional inputs (up to five, 0-4)

In order to get your head around how it all works, I'd recommend dropping this object in an empty project and paying attention to the debug messages that come out as you tap around:

Information about object: obj_touch_input
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:
Code:
// touch intputs
for (var i = 4; i > -1; i--)
{
   mouse[i]            = false;
    mouse_pressed[i]    = false;
    mouse_released[i]   = false;
    mouse_rx[i]         = 0; //mouse x relative to room
    mouse_ry[i]         = 0; //mouse y relative to room
    mouse_gx[i]         = 0; //mouse x relative to gui
    mouse_gy[i]         = 0; //mouse y relative to gui
}
Step Event:
execute code:
Code:
// iterate through mouse devices (potential touch inputs) and collect input data
for (var i = 0; i < 5; i++)
{
   if device_mouse_check_button(i, mb_any)
    {
        mouse_pressed[i]    = !mouse[i];
        mouse[i]            = true;
        mouse_released[i]   = false;
        mouse_rx[i]         = device_mouse_x(i); // mouse x relative to room
        mouse_ry[i]         = device_mouse_y(i);
        mouse_gx[i]         = device_mouse_x_to_gui(i); // mouse x relative to gui
        mouse_gy[i]         = device_mouse_y_to_gui(i);
        if (mouse_pressed[i]) {show_debug_message("mouse: " + string(i) + " pressed");}   
    }
    else
    {
        mouse_released[i]   = mouse[i];
        mouse[i]            = false;
        mouse_pressed[i]    = false;
        if (mouse_released[i]) {show_debug_message("mouse: " + string(i) + " released");}
    }
}
Draw GUI Event:
execute code:
Code:
for (var i = 0; i < 5; i++)
{
   if (mouse[i])
    {
        draw_circle(mouse_gx[i], mouse_gy[i], 64, false);
    }
}
 
Top