Jump to content


Photo
* * * * - 7 votes

[Studio] Touch Screen Controls


  • This topic is locked This topic is locked
50 replies to this topic

#1 iSeiren

iSeiren

    www.worrall.pw

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

Posted 13 November 2011 - 11:45 PM

  • Title: Touch Screen Controls
  • Description: Allows your users to use a touch screen to control the game
  • GM Version: GM:Studio
  • Registered: yes
  • File Type: .zip
  • File Size: 84kb
  • File Link: DOWNLOAD
  • Required Extensions: N/A
  • Required DLLs: N/A

Summary


UPDATED TO THE LATEST VERSION OF GAME MAKER STUDIO.

This example wont be useful to a lot of you, but it will be useful for those who wish to develop games for Touch Screen devices - such as the iPad or Android tablets. You get on-screen buttons which you can click/press. This sends a virtual key press to the game which in turn activates any key-press events you have.

Short and sweet. The link below is for a live demo of the tutorial. Enjoy.

DEMO -Dead link, will be back soonTM

Spoiler

Edited by iSeiren, 21 May 2014 - 09:12 AM.

  • 9

Professional Mobile app Developer


#2 _230411

_230411

    GMC Member

  • New Member
  • 13 posts

Posted 18 November 2011 - 04:11 AM

Does it support Multi-Touch?
  • 0

#3 iSeiren

iSeiren

    www.worrall.pw

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

Posted 25 November 2011 - 10:52 PM

Does it support Multi-Touch?


Yes :). (For the controls) So you could add a jump or fire button.



  • 1

Professional Mobile app Developer


#4 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 04 January 2012 - 11:08 AM

Awesome, I have been looking for something like this :biggrin:
+1
  • 0

#5 njp

njp

    Panda

  • GMC Member
  • 2342 posts
  • Version:GM8

Posted 07 January 2012 - 07:17 AM

*clap clap clap* +1 Posted Image
however id recommend using this to adjust the views (its smoother for me and has less bugs, i edited this from another example given to me a few weeks ago):
if ( (view_wport != browser_width) || (view_hport != browser_height) )
{
	view_xview[0] = 0;
	view_yview[0] = 0;
	view_wview[0] =  browser_width
	view_hview[0] =  browser_height

	
	view_xport[0] = 0;
	view_yport[0] = 0;
	view_wport[0] =  browser_width
	view_hport[0] =  browser_height}

Edited by njp, 07 January 2012 - 07:18 AM.

  • 0

[--NJP--]


#6 iSeiren

iSeiren

    www.worrall.pw

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

Posted 07 January 2012 - 01:26 PM

*clap clap clap* +1 Posted Image
however id recommend using this to adjust the views (its smoother for me and has less bugs, i edited this from another example given to me a few weeks ago):

if ( (view_wport != browser_width) || (view_hport != browser_height) )
{
	view_xview[0] = 0;
	view_yview[0] = 0;
	view_wview[0] =  browser_width
	view_hview[0] =  browser_height

	
	view_xport[0] = 0;
	view_yport[0] = 0;
	view_wport[0] =  browser_width
	view_hport[0] =  browser_height}


The main focus of the tutorial is the controls, not the game filling the screen. But thanks for posting it - maybe people will find it useful ^^.
  • 0

Professional Mobile app Developer


#7 KaloyanBeshev

KaloyanBeshev

    GMC Member

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

Posted 21 November 2012 - 03:10 PM

Perfect, thank you. Will try them first thing tommorow morning :) !
  • 0

#8 elsato

elsato

    GMC Member

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

Posted 22 November 2012 - 09:00 AM

hey this is useful! thanks! :>
  • 0

#9 elsato

elsato

    GMC Member

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

Posted 28 December 2012 - 05:27 PM

hey!
just today had the chance to try it on android, and i get this error in the device

ERROR in
action number 1
of Step Event2
for object obj_fitwindow:

illegal virtual key handle


this happens when i press any of the virtual keys

Edited by elsato, 28 December 2012 - 05:27 PM.

  • 0

#10 iSeiren

iSeiren

    www.worrall.pw

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

Posted 28 December 2012 - 05:45 PM

Yeh it needs updating. I'll sort it soon
  • 0

Professional Mobile app Developer


#11 iSeiren

iSeiren

    www.worrall.pw

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

Posted 29 December 2012 - 01:36 PM

I have updated this to work with the latest version of Game Maker Studio.
  • 0

Professional Mobile app Developer


#12 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 24137 posts
  • Version:GM:Studio

Posted 31 December 2012 - 09:19 AM

Given the fact that this is a great little tutorial and that many people in need of this information, I'm moving this into the staff pick section of the forums. Well done!!!
  • 0

lz6lxdC.pngd7ZQQ3F.gifFlvJzyf.png

40799.png


#13 Genaut

Genaut

    GMC Member

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

Posted 23 February 2013 - 09:49 AM

Nice example. Thanks a lot! I dont see any code in the game maker file that allows touch the sprites... the example .exe works great but the game maker project no!

Edited by Genaut, 23 February 2013 - 02:29 PM.

  • 0

#14 matidefa

matidefa

    GMC Member

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

Posted 08 March 2013 - 11:54 PM

how to install the extension and dll: N / A?
  • 0

#15 iSeiren

iSeiren

    www.worrall.pw

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

Posted 08 March 2013 - 11:56 PM

N/A means Not Applicable, meaning you don't need to do anything :).
  • 0

Professional Mobile app Developer


#16 matidefa

matidefa

    GMC Member

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

Posted 09 March 2013 - 02:41 AM

then what happens? when I try it on windows do not work that does not move?

sorry for my bad English
  • 0

#17 iSeiren

iSeiren

    www.worrall.pw

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

Posted 14 March 2013 - 08:41 PM

This won't work on Windows, you will have to test it on a mobile or HTML5.
  • 0

Professional Mobile app Developer


#18 Brano000

Brano000

    Indie Game Developer

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

Posted 03 April 2013 - 02:27 PM

Thank You very much! ^^


  • 0

My unfinished blog with unfinished games

branislavjovic.blogspot.com

 


#19 mizerr

mizerr

    GMC Member

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

Posted 23 April 2013 - 11:35 PM

AWESOME! Thank you very much for the tutorial, helped me past an annoying issue! rep given.


  • 0

#20 iSeiren

iSeiren

    www.worrall.pw

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

Posted 27 April 2013 - 10:41 AM

That hasn't changed, in your Menu room - put your button object with the mouse left pressed event as    room_goto("GameRoom");

 

GameRoom being the name of the room you want to go to.

 

 

 

The idea behind this tutorial allows users the use of multi-touch buttons etc. Menu buttons don't need this feature. There are other reasons too.


  • 0

Professional Mobile app Developer


#21 iSeiren

iSeiren

    www.worrall.pw

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

Posted 27 April 2013 - 06:38 PM

For simple buttons, just left pressed.


  • 0

Professional Mobile app Developer


#22 dark3000light

dark3000light

    GMC Member

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

Posted 19 May 2013 - 04:48 PM

How do I reverse the position of the keys? So they appear on the left side of the screen instead?


  • 0

#23 Dralger

Dralger

    GMC Member

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

Posted 14 September 2013 - 05:29 AM

hey!
just today had the chance to try it on android, and i get this error in the device

ERROR in
action number 1
of Step Event2
for object obj_fitwindow:

illegal virtual key handle


this happens when i press any of the virtual keys

 

I am getting the same exact error, they keys are showing up on my phone and all looks good but it crashes immediately with this error.


  • 0

#24 emartinez1986

emartinez1986

    GMC Member

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

Posted 12 October 2013 - 05:58 AM

Yes, don't copy code, try to understand it... then you don't need examples, only your brain. Steps to create code - think what you want to do:

1. What you need to move screen? Put finger on screen and move finger.
2. How to check that finger is moved? Check distance and direction from starting point, while finger is touching screen.
3. When to stop moving? When finger will stop touching screen. It's release event.

So, now:

On MousePressLeft - assign to some variables: current x, y, and that moving started (moving = true or something).
On MouseLeft - if moving = true, you can move view on x/y axis, checking direction from point x,y that you previously saved, to point x,y of mouse now - lenghtdir_x/y will be helpful here (where len will be speed, and dir will be... direction of course). You can put argument, that screen will start to move after some distance from begining point.
On MouseReleaseLeft = moving = false and that's all

Now you've got nearly ready code - just write it :)


  • 0

#25 divyanshkumar

divyanshkumar

    GMC Member

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

Posted 30 October 2013 - 05:07 PM

hi please re-upload your file it . when i click on the link it says "the file not found". please do it it will help me a lot.


  • 0

#26 2d_warrior

2d_warrior

    GMC Member

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

Posted 24 November 2013 - 04:14 AM

This won't work on Windows, you will have to test it on a mobile or HTML5.

 

Not at all, or just without a touchscreen?


  • 0

#27 iSeiren

iSeiren

    www.worrall.pw

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

Posted 08 December 2013 - 06:39 PM

 

This won't work on Windows, you will have to test it on a mobile or HTML5.

 

Not at all, or just without a touchscreen?

 

 

The windows compiler wont compile virtual keys.


  • 0

Professional Mobile app Developer


#28 dm3

dm3

    GMC Member

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

Posted 12 January 2014 - 01:08 AM

thank u


  • 0

#29 vidokas

vidokas

    GMC Member

  • GMC Member
  • 326 posts
  • Version:GM8

Posted 26 February 2014 - 06:40 PM

did it would be possible to make that users can draw line or something?
like user touches screen and moves finger trough display and that line would appear in game?


maybe with some checkpoints or something similer
*_____*____*____*
|           |

|           |

*_____*

* - touch


i even found game for explain what ask
http://www.lessmilk.com/7/


Edited by vidokas, 27 February 2014 - 11:31 PM.

  • 0

Most popular game in gmc forums would be...
Zombie shooter rpg in minecraft world with zelda as main character which can summon pokemons.


#30 iSeiren

iSeiren

    www.worrall.pw

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

Posted 01 March 2014 - 06:41 PM

did it would be possible to make that users can draw line or something?
like user touches screen and moves finger trough display and that line would appear in game?


maybe with some checkpoints or something similer
*_____*____*____*
|           |

|           |

*_____*

* - touch


i even found game for explain what ask
http://www.lessmilk.com/7/

 

While i could make a game link this, i don't think it's relevant to this tutorial.

 

I'd help you with it, but right now I'm extremely busy.

 

Ask on the forums, I'm sure somebody can help :).


  • 0

Professional Mobile app Developer


#31 Sydrik

Sydrik

    GMC Member

  • GMC Member
  • 41 posts
  • Version:Unknown

Posted 13 March 2014 - 11:28 AM

Hi. Link seems to be broken. Or do we have another similar tutorial available somewhere? Thanks.


  • 0

"AAAAAARRRRGGGGHHHHH!!!!!" -- Arnold Schwarzenegger, Total Recall

#bestmoviequotes


#32 prestodomino

prestodomino

    GMC Member

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

Posted 24 March 2014 - 12:05 AM

Same here, link broken......


  • 0

#33 iSeiren

iSeiren

    www.worrall.pw

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

Posted 24 March 2014 - 12:10 AM

Fixed the links :).


  • 0

Professional Mobile app Developer


#34 prestodomino

prestodomino

    GMC Member

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

Posted 24 March 2014 - 01:45 PM

working

 

thank you :thumbsup:


  • 0

#35 aWeSoMaTiC

aWeSoMaTiC

    GMC Member

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

Posted 16 April 2014 - 07:23 AM

Link seems to be broken again! help! =(


Edited by aWeSoMaTiC, 16 April 2014 - 07:24 AM.

  • 0

#36 iSeiren

iSeiren

    www.worrall.pw

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

Posted 16 April 2014 - 07:41 AM

Sorry, i've been hopping around web hosts. Should be fixed Soontm if not i'll get it fixed :).


  • 0

Professional Mobile app Developer


#37 iSeiren

iSeiren

    www.worrall.pw

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

Posted 16 April 2014 - 03:42 PM

Working now :).

 

When i move my website again i'll add everything to GIT!


  • 0

Professional Mobile app Developer


#38 maximaxis

maximaxis

    GMC Member

  • New Member
  • 6 posts

Posted 30 April 2014 - 12:56 PM

Wow! This example is awesome and simple at the same time, thank you very much


  • 0

#39 Carnivac

Carnivac

    The Hunter

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

Posted 17 May 2014 - 06:54 PM

Link ain't working.


  • 0

Spoiler

MOD EDIT: Your signature is over the maximum total permitted height of 150px and has been spoilered. Please fix.


#40 iSeiren

iSeiren

    www.worrall.pw

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

Posted 17 May 2014 - 07:23 PM

Sorry, keeps happening. i've put the download back. The demo isnt there however. I'll fix the demo at some point.


  • 0

Professional Mobile app Developer


#41 rsbthebest

rsbthebest

    GMC Member

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

Posted 31 May 2014 - 12:26 AM

Link broken pleas pm the file i really need it
  • 0

#42 rsbthebest

rsbthebest

    GMC Member

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

Posted 31 May 2014 - 12:37 AM

Link broken pleas pm the file i really need it
  • 0

#43 iSeiren

iSeiren

    www.worrall.pw

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

Posted 31 May 2014 - 01:58 PM

Link broken pleas pm the file i really need it

 

 

Link works fine for me.


  • 0

Professional Mobile app Developer


#44 mrsmes

mrsmes

    GMC Member

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

Posted 02 June 2014 - 02:57 AM

does this mean i need to compile my project into a android game and put it on the android just to test it out, and confirm their are no bugs?

well i tested it on my pc but only my actual keyboard keys worked none of the onscreen keys worked... please fix...


Edited by mrsmes, 02 June 2014 - 03:05 AM.

  • 0

Assuming I helped you out in a questions and answers topic won't you return the favour by helping me with one my coding problems, or recommend some one who can chat to me over pms about helping and how to overcome my obstacles, after all lets just say I did help you or them or many people with similar problems, in that topic.

Here i have a topic for those of you struggling with type writer text and mugshots in your games especially if it is a rpg see the link below for more info

http://gmc.yoyogames...howtopic=619103

almost no code needed, only uses two events.

click here for the l8est version of feed the alien pizza, it has some major polished up features.


#45 iSeiren

iSeiren

    www.worrall.pw

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

Posted 02 June 2014 - 11:51 AM

does this mean i need to compile my project into a android game and put it on the android just to test it out, and confirm their are no bugs?

well i tested it on my pc but only my actual keyboard keys worked none of the onscreen keys worked... please fix...

 

On screen keys don't work on windows, you have to compile to HTML5, android, iOS, windows 8 etc...


  • 0

Professional Mobile app Developer


#46 mathshark

mathshark

    GMC Member

  • GMC Member
  • 21 posts
  • Version:Unknown

Posted 19 June 2014 - 05:27 AM

 

does this mean i need to compile my project into a android game and put it on the android just to test it out, and confirm their are no bugs?

well i tested it on my pc but only my actual keyboard keys worked none of the onscreen keys worked... please fix...

 

On screen keys don't work on windows, you have to compile to HTML5, android, iOS, windows 8 etc...

 

Sorry if this is a bit late, but you seem knowledgable...  can you test virtual keys on a PC if you compile to HTML5 or do you have to upload it and view it on another device every time?


  • 0

#47 iSeiren

iSeiren

    www.worrall.pw

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

Posted 19 June 2014 - 07:51 AM

 

 

does this mean i need to compile my project into a android game and put it on the android just to test it out, and confirm their are no bugs?

well i tested it on my pc but only my actual keyboard keys worked none of the onscreen keys worked... please fix...

 

On screen keys don't work on windows, you have to compile to HTML5, android, iOS, windows 8 etc...

 

Sorry if this is a bit late, but you seem knowledgable...  can you test virtual keys on a PC if you compile to HTML5 or do you have to upload it and view it on another device every time?

 

 

Virtual keys should work with the mouse on HTML5 :).


  • 0

Professional Mobile app Developer


#48 Rexusxx70

Rexusxx70

    GMC Member

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

Posted 21 June 2014 - 07:43 PM

ok, this works, but question....how to manage only for horizontal staying android. when going in normal comands are bellow of screen. Thanks for answer. :)


  • 0

#49 ScottyGibby

ScottyGibby

    GMC Member

  • New Member
  • 1 posts
  • Version:None

Posted 26 March 2015 - 11:47 PM

The dropbox link has a 404 error, is there a mirror for the file? :hmmm:


  • 0

#50 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 24137 posts
  • Version:GM:Studio

Posted 27 March 2015 - 06:20 AM

The dropbox link has a 404 error, is there a mirror for the file? :hmmm:

 

GameMaker comes with multiple tutorials on touch-screen controls. Have you gone through them? I think you'll find that they cover a lot more than this tutorial did... :thumbsup:


  • 1

lz6lxdC.pngd7ZQQ3F.gifFlvJzyf.png

40799.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users