GUI "Layer", buttons & mobile game


GM Version: 2
Target Platform: iOS and Android (not tested)
Download: N/A

Create control buttons (left, right and jump) for your game on iOS devices. Clic on the link above.

Tutorial: This tutorial is in English & Français. I Apologize for my english and i'm sorry if i made mistakes because it's not my native language...but i do my best;-).

What is the best way to fix the position of the control buttons on the screen?
If you just place the instance of your button object within the room, when the camera moves, the button moves too!
You can use 2 variables to record the position of the camera view X and Y. Then in the step event, you can set the position X and Y of all buttons relative to the camera like this:
(step event)
Xbutton = Xcam + Xoffset…
Ybutton = ...
So, they will move together but not really at the same time!!! If you do that, buttons will be always visible, but they won’t be fixed! You’ll see a little delay between the move of the camera and the buttons because GM has to recalculate continuously their position…wrong way!
That’s why we need to use the GUI Layer and the DrawGUI event!

To read more, clic on the tutorial link.
Last edited:
Awesome. There's a limited amount of tutorials/examples on this subject. I sincerely appreciate the time and effort that you've put into this. I'm eager to try it out! Have you tested it on any other platforms? Windows, Android, HTML5, etc.? When I have some time to tinker with it I will be sure to post my findings, as well as my changes (if there are any.)

Thanks a million!


Thank you so much for your comment! I tested this method on all iOS devices. But, i think it should work on all touch screen devices.


Bro you are amazing thank you so much foe the tutorial ...... I wish you all the best in life. YOU MADE MY DAY BRO