Jump to content


Photo

EXTENSION: iPhoneGM (iPhone accelerometer access)


  • Please log in to reply
19 replies to this topic

#1 aiacono

aiacono

    GMC Member

  • New Member
  • 13 posts

Posted 25 September 2011 - 11:50 PM

Hey guys,

Link to GEX: http://imkcreative.c...ml/iphonegm.gex

You can access the x, y, and z of the accelerometer using iphone_acceleration_x(), iphone_acceleration_y(), and iphone_acceleration_z()

Enjoy!
  • 0

#2 cotycrg

cotycrg

    GMC Member

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

Posted 26 September 2011 - 12:36 AM

Would this work on an Android device, as well? If not, it would be neat if you could make it do so!
  • 0

#3 Manuel777

Manuel777

    InvaderGames

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

Posted 26 September 2011 - 10:30 AM

Would this work on an Android device, as well? If not, it would be neat if you could make it do so!

That ^
  • 0

@MEtchegaray7

gplussignature.png

May this signature be frozen on the old GMC until the end of times. Or YoYo takes it down.


#4 aiacono

aiacono

    GMC Member

  • New Member
  • 13 posts

Posted 26 September 2011 - 04:09 PM

Unless I'm wrong, I'm pretty sure the accelerometer for Android is not accessible in Javascript. I'm sure someone could work around it with an additional flash or Java applet on the webpage.
  • 0

#5 slam drago

slam drago

    The slam drag

  • New Member
  • 422 posts
  • Version:GM:Studio

Posted 26 September 2011 - 04:17 PM

Why not add the ability to get touches?
  • 0
My newest website. Check it out!
I support Cryset Games. Make money playing and making games!
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
My avatar is best viewed in the lighter GMC theme.

#6 aiacono

aiacono

    GMC Member

  • New Member
  • 13 posts

Posted 26 September 2011 - 04:20 PM

Why not add the ability to get touches?


The only reason this extension was possible is the fact that window.ondevicemotion passes X, Y, and Z in event. I'm not sure what one would need to do for touch support.
  • 0

#7 Mark Overmars

Mark Overmars

    Game Maker Creator

  • GMC Elder
  • 805 posts
  • Version:Unknown

Posted 26 September 2011 - 04:55 PM

Touch can simply be done using the mouse events. Or you can use the virtual keys.
  • 0
Mark Overmars, YoYo Games, www.yoyogames.com

Twitter:
twitter.com/mark_overmars
Check out my book The Game Maker's Apprentice
Buy my iPhone/iPad/Android game Super Snake HD

#8 aiacono

aiacono

    GMC Member

  • New Member
  • 13 posts

Posted 26 September 2011 - 05:34 PM

Touch can simply be done using the mouse events. Or you can use the virtual keys.


Ah, very cool.

By the way, is there a better place for me to be posting my extensions specifically for GML:HTML5?
  • 0

#9 cotycrg

cotycrg

    GMC Member

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

Posted 26 September 2011 - 06:40 PM

Touch can simply be done using the mouse events. Or you can use the virtual keys.

Yeah but that doesn't work with multitouch devices. Well it does, but with only the first touch. The 2nd-4th are completely ignored.
  • 0

#10 xot

xot

    GMC Dismember

  • GMC Elder
  • 4785 posts
  • Version:GM:Studio

Posted 26 September 2011 - 06:53 PM

Virtual keys map regions of the screen to key events. Any number of those can be fired at once -- multitouch. You might have to get creative to do multitouch swipes and pinches, but it's possible.
  • 0
GMLscripts.com, rise from your grave!

If any of my posts contain broken images or links, I can probably supply them for you. PM with a link to the post.

#11 BlaXun

BlaXun

    Slime Online Creator

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

Posted 26 September 2011 - 06:57 PM

Using a sprite as a collision box for touch would be nice, no?
  • 0

iBNKRoX.png


#12 connorcarpenter

connorcarpenter

    GMC Member

  • GMC Member
  • 6 posts

Posted 22 October 2011 - 07:55 PM

Actually, in my game there are virtual keys for moving and shooting - and what xot said doesn't seem to be the case - my character cannot register move and shoot commands at the same time.

Edited by connorcarpenter, 22 October 2011 - 07:55 PM.

  • 0

#13 XverhelstX

XverhelstX

    Xtremely Virtual St.

  • New Member
  • 521 posts
  • Version:Unknown

Posted 25 November 2011 - 09:20 PM

Just to let you know that I am making an extension where users will be able to access native Android stuff like GPS, accelerometer, bluetooth functions, screen device width etc
AND I am also looking for a way to publish an app to the Android Market that was build with GMHTML5.
I hope to get it released soon.

XverhelstX

EDIT:

Here's a small file that will show a toastmessage on your android device called from within GM:HTML5:

www.rootsoftllc.com/ShowToast.zip

It has a compiled .apk file included too, so you can try it out.
it has an object and when you press the object, a toastmessage appears.
I will try to add much more options if you guys are intrested.
In your gm:html5, you just call ShowToast("message")

Tomas

Edited by XverhelstX, 25 November 2011 - 10:35 PM.

  • 0


Posted Image
View our new site!
www.rootsoftllc.com


#14 imam_mashur

imam_mashur

    GMC Member

  • New Member
  • 282 posts
  • Version:Unknown

Posted 17 January 2012 - 09:25 AM

I don't know why but when i open the links..
I saw this..

���N��g������o���*0&o���5&.2 l�������r��� )���3&&506&!-0030..&3-(.&ݗ����������������j���}g��t���2*0&(.+���&:5&02*0&(.+b���t���2*0& 5����d���}g��t���2*0& 5t���2*0& 5t���������������g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���}g��G���2*0& &-&350 :G���2*0& &-&350 :t���������������g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���}g��G���2*0& &-&350 G���2*0& &-&350 t���������������g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���}g��G���2*0& &-&350 ;G���2*0& &-&350 ;t���������������g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g���g�������x���:]^SZzTw›N58~Rvl '4m@Q:@+g'bYcp[<KO!z(P]r=L!]^oeQ?<$}K%B8 3on§
m`I)&y"\͵瀻a[Q?


  • 0

Sorry if my english is BAD. I tried my best to study english.

Simple Menu Example---Draw your health bar

Spoiler


#15 ipq

ipq

    GMC Member

  • GMC Member
  • 34 posts

Posted 18 January 2012 - 10:59 PM

@imam_mashur: Just point the link, right click and save the target file...
  • 0
Posted Image Favorite GM game that we play like.
I am advanced of GM, sorry my english texts.

#16 ionasskopelitis

ionasskopelitis

    GMC Member

  • GMC Member
  • 14 posts
  • Version:GM8

Posted 09 April 2012 - 06:19 PM

Unless I'm wrong, I'm pretty sure the accelerometer for Android is not accessible in Javascript. I'm sure someone could work around it with an additional flash or Java applet on the webpage.

dude android is written in java me myself know some java
  • 0

#17 Mirac7

Mirac7

    GMC Member

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

Posted 17 April 2012 - 06:53 PM

Can somebody explain me how do I use these:

iphone_acceleration_x(),
iphone_acceleration_y(),
iphone_acceleration_z()

Cuz I am unable to write a single working line of code on my own...
Thanks
I need to move instance of an object left and right by tilting.
  • 0

#18 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:Unknown

Posted 23 April 2012 - 12:27 PM

Just to let you know that I am making an extension where users will be able to access native Android stuff like GPS, accelerometer, bluetooth functions, screen device width etc
AND I am also looking for a way to publish an app to the Android Market that was build with GMHTML5.
I hope to get it released soon.

XverhelstX

EDIT:

Here's a small file that will show a toastmessage on your android device called from within GM:HTML5:

www.rootsoftllc.com/ShowToast.zip

It has a compiled .apk file included too, so you can try it out.
it has an object and when you press the object, a toastmessage appears.
I will try to add much more options if you guys are intrested.
In your gm:html5, you just call ShowToast("message")

Tomas


Yeah I had this problem too then i used this:
I found a way to easily convert your completed app so it is android market compatible

Click Here

Edited by DefuzionGames, 23 April 2012 - 01:20 PM.

  • 0

#19 Sorga68

Sorga68

    GMC Member

  • New Member
  • 3 posts
  • Version:GM:Studio

Posted 30 August 2013 - 02:14 PM

Hey guys,

 

I tried to access the accelerometer values with the extension above on my iPhone 4 using GMS 1.2 but the values returned from the functions stay at 0.

I initialized variables and made some text output to test.

 

To make sure there are values returned, I assigned initial values to the variables in the create event of my controller object.

These initial values are overwritten with 0 after calling iphone_acceleration_x() etc.

 

Is there anything else I need to do before I can call these functions because these are javascript?

(The extension is installed and added to the project.)

 

Has anyone managed to get these working?

 

Thanks for any help or clues :)

 

Steffen


  • 0

#20 Myster

Myster

    GMC Member

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

Posted 09 February 2014 - 12:22 AM

Just for those visiting this thread in the future (ie. like me), accelerometer functions are now built in to the relevent GMS extension packages (e.g. Android, iOS, etc) and can be accessed using the following methods:
device_get_tilt_x()

device_get_tilt_y()

device_get_tilt_z()

 

Consult the GMS Manual for more information...


  • 1

 rgr-thumb.pngrgr-thumb2.pngrgr-thumb3.png

Download my mobile game Run Gary Run made in Game Maker, available on iOS here (FREE for a limited time), or FREE on Android here.

 

Follow me!

website  |  youtube  |  twitter