+1 vote

I'm testing a game for android.

When I try to implement the vibration I get this error: the method vibrate_handheld isn't declared in the current class.

The only thing about vibration I coud find was here

Https://docs.godotengine.org/en/3.2/classes/class_input.html#class-input-method-vibrate-handheld

This is my code (if i remove the vibrate line it works perfectly on both windows and android):

func _physics_process(delta):
    $score.set_text(str(score))

    if Input.is_mouse_button_just_pressed(1):
        score += 1
        vibrate_handheld(500)

I know I'm doing something wrong in that last line but I dont know how to put the vibration method.

Thank you very much!

in Engine by (58 points)

1 Answer

+1 vote
Best answer

The vibrate_handheld function is a method of the Input class. Change that line of code to look like this

Input.vibrate_handheld(500)
by (46 points)
selected by

that worked perfectly! thank you very much!!!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.