GameMaker (all)
Icon

Haptics

Mick @ GamePhase

You must be logged in to obtain assets

Description

Create haptic effects (vibrations) on Android with this easy to use asset. You can set your Android device to vibrate for a specified amount of time or through patterns of varying lengths. Simple demo is included. Since this asset relies on a native Android extension, the haptic effects will not work when running or debugging, you need the create an apk to test the functionality.

Important!: Please update this extension to the newest version. The vibrate functions as they were have been deprecated in SDK version 26 (Android 8.0) and cause problems on newer devices. The newest version of this extension includes a Java file that uses the updated functions that you can use if targeting SDK version 26 or higher. Please test this out and contact me if there are problems before leaving a bad review and I will look into it, thanks!

Please note: Set minimum sdk to at least 11. If you target API level 26+ (Android 8.0+) in GMS2, then copy the included file "Haptics_SDK26.java" to [Project]/extensions/Haptics/AndroidSource/Java. Take a backup of and remove "Haptics.java" already in that directory and rename "Haptics_SDK26.java" to "Haptics.java".

Functions:

  • Haptics_HasVibrator()
  • Haptics_Vibrate(milliseconds) // Set argument to -1 to vibrate indefinitely
  • Haptics_VibrateIntensity(milliseconds, intensity) // Intensity can be the values 1 to 5, set first argument to -1 to vibrate indefinitely
  • Haptics_Pattern2(vibrate1_ms, pause1_ms, vibrate2_ms)
  • Haptics_Pattern3(vibrate1_ms, pause1_ms, vibrate2_ms, pause2_ms, vibrate3_ms)
  • Haptics_Pattern4(vibrate1_ms, pause1_ms, vibrate2_ms, pause2_ms, vibrate3_ms, pause3_ms, vibrate4_ms)
  • Haptics_PatternString(pattern_string) // Comma delimited string for longer and more advanced patterns
  • Haptics_PatternStringRepeat(pattern_string) // Like the function above, but pattern will be repeated indefinitely
  • Haptics_StopVibration() // Stop vibration, use when device has been set to run indefinitely using any of the functions above

You are allowed to use this asset in any game you make, commercial or free, but you are not allowed to include this asset in other assets on the Gamemaker Marketplace.

End User Licence Agreement (EULA).

Age Rating: None

Versions

GMS1 - Version 1.3.1. Published October 2, 2018

  • Should now work with API level 26+ (Android 8.0+)

GMS2 - Version 1.3.1. Published October 2, 2018

  • Should now work with API level 26+ (Android 8.0+)
Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait