A downloadable asset pack

Download NowName your own price

Game Depicted in Screenshots: Crawl Space (Google Play)


Easy to use Mobile Control Manager for Game Maker Studio 2 built from scratch by me


How to import into Game Maker Studio 2

1. Download the Asset

2. Import it by going to Tools -> Import Local Package -> Select our yymep file

3. Add all the assets(There is only one)

4. Drop the object (obj_mobileControl_controller) into your room somewhere

5. Now Mobile Controls will draw to the screen

How to use the Joystick Direction to control an Object

First you want to get the joystick directions and strength

var _leftStickDir = global.mobileControlManager.getStickDirection("left");
var _rightStickDir = global.mobileControlManager.getStickDirection("right");
var _leftStickStrength = global.mobileControlManager.getStickStrength("left");
var _rightStickStrength = global.mobileControlManager.getStickStrength("right");

Then, Personally you might want to have a lock on the angles that will register a new direction, (So instead of 360 Directions you can split it to be 8 or 16 directional if you want), You can do that like this

var angle_lock = 22.5;
mobile_dir = round(_leftStickDir/angle_lock)*angle_lock;

We can also determine our speed like so

var speed = max_speed * (_leftStickStrength / 100);

And you can use the direction to set an image direction for your object also

image_dir = ((round(mobile_dir/angle_lock))*angle_lock)-90;

What about Virtual Buttons?

This Object supports Virtual Buttons on the screen as well so you can draw different UI Elements whereever you  need to with whatever sprite you want and assign it a function to execute when tapped, It is incredibly simple all you need to do is

global.mobileControlManager.addVirtualButton(spr_reset_gui, player_death, null_func, display_get_gui_width(), 5);
global.mobileControlManager.addVirtualButton(spr_sprint_gui, player_sprint, null_func, display_get_gui_width(), 48 + 10);
global.mobileControlManager.addVirtualButton(spr_radio_gui, skipTrack, null_func, display_get_gui_width(), display_get_gui_height() - 5 - 48);

Arguments involved: 

sprite
function to execute on press
function to execute when not held (not implemented)
x position on the gui
y position on the gui

Current functions dont take in any arguments, So you can do stuff like this right now though

function player_death() {
    with(objPlayer) {
        death();
    }
}
function player_sprint() {
    if (keyboard_check(vk_shift)) {
        keyboard_key_release(vk_shift);
    } else {
        keyboard_key_press(vk_shift);
    }
}
function skipTrack() {
    global.radioController.nextTrack();
}

And they are passed as the second argument in the addVirtualButton method


That is pretty much everything for now, Hope you enjoy


This has been tested on Android, I do not currently have an iOS device to test this with

Download

Download NowName your own price

Click download now to get access to the following files:

mobileControl_controller.yymps 10 kB

Leave a comment

Log in with itch.io to leave a comment.