Jump to content


Photo

Tilt Issues


  • Please log in to reply
7 replies to this topic

#1 xPac7x

xPac7x

    GMC Member

  • GMC Member
  • 256 posts
  • Version:GM:Studio

Posted 23 May 2012 - 10:11 PM

Hello fellow devs,

I have been playing around with many of the new function as we all have I am sure, but have not been able to utilize the Tilt functions correctly yet... Of course it seems as simple as telling my object to set:

x += device_get_tiltx() //With proper syntax of course

...and to assume that I would be able to set my game into portrait (although that doesnt matter exactly yet) and tilt on the X-axis and watch my object follow accordingly. However it just sits there...lifeless.

I am running on a Droid X and have yet to test on another device...

Have you guys/girls had any luck with the Tilt functions yet? I suppose after this post I should get on Mantis and look into it, but seems the forums are the best source for help.


Thank you for your time & advice, and Game on.
  • 0

#2 ClassyGoat

ClassyGoat

    Goatee Connoisseur

  • GMC Member
  • 410 posts
  • Version:GM:Studio

Posted 25 May 2012 - 03:15 AM

I just tested it out on my Samsung Galaxy SII running Android 4.0.4 and the tilt functions seemed to work just fine.
I used this as movement script:
x += device_get_tilt_y() * 20;
y += device_get_tilt_x() * 20;

  • 0

#3 WWAZman

WWAZman

    GMC Member

  • GMC Member
  • 708 posts
  • Version:GM:Studio

Posted 25 May 2012 - 03:32 AM

Is there a tilt tutorial out there somewhere? I'd love to play with that for my next title, but I need to LEARN the damn system first! :D
  • 0

#4 xPac7x

xPac7x

    GMC Member

  • GMC Member
  • 256 posts
  • Version:GM:Studio

Posted 25 May 2012 - 06:24 PM

Yeah ive tried many variations of code exactly like that with no luck. I am very experienced with gamemaker so I am thinking maybe it is time to test on another device and look for some results.
  • 0

#5 yvesnadjarian

yvesnadjarian

    GMC Member

  • GMC Member
  • 158 posts
  • Version:GM:Studio

Posted 09 June 2012 - 03:42 PM

I just tested it out on my Samsung Galaxy SII running Android 4.0.4 and the tilt functions seemed to work just fine.
I used this as movement script:

x += device_get_tilt_y() * 20;
y += device_get_tilt_x() * 20;



Thankyou ClassyGoat... this is what helped me on my S2 too.
Just one comment... the function you post here seems to be used for landscape right?

On my tests for Portait mode the x funcion would me like this:

x -= device_get_tilt_x() * 20;


Anyway... this is the best Tilt result I´ve got so far!
  • 0

#6 filulilus

filulilus

    GMC Member

  • GMC Member
  • 928 posts
  • Version:GM:Studio

Posted 11 June 2012 - 10:08 AM

Do what I did, observe the results before actually using them! :thumbsup:

draw_text(10, 10, 'X tilt: ' + string(device_get_tilt_x()))
draw_text(10, 30, 'Y tilt: ' + string(device_get_tilt_y()))
draw_text(10, 50, 'Z tilt: ' + string(device_get_tilt_z()))

  • 1

#7 WWAZman

WWAZman

    GMC Member

  • GMC Member
  • 708 posts
  • Version:GM:Studio

Posted 11 June 2012 - 06:20 PM

Do what I did, observe the results before actually using them! :thumbsup:

draw_text(10, 10, 'X tilt: ' + string(device_get_tilt_x()))
draw_text(10, 30, 'Y tilt: ' + string(device_get_tilt_y()))
draw_text(10, 50, 'Z tilt: ' + string(device_get_tilt_z()))



where are you putting that? I tried on my Vibrant and it's not working.
  • 0

#8 filulilus

filulilus

    GMC Member

  • GMC Member
  • 928 posts
  • Version:GM:Studio

Posted 11 June 2012 - 09:54 PM

where are you putting that? I tried on my Vibrant and it's not working.

In the draw event, if you are using views, use this code instead:

draw_text(view_xview[0] + 10, view_yview[0] + 10, 'X tilt: ' + string(device_get_tilt_x()))
draw_text(view_xview[0] + 10, view_yview[0] + 30, 'Y tilt: ' + string(device_get_tilt_y()))
draw_text(view_xview[0] + 10, view_yview[0] + 50, 'Z tilt: ' + string(device_get_tilt_z()))

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users